private void copyFromIsToOs(InputStream in, OutputStream out, int length) throws IOException {
    while (length > 0) {
      int bytesRead = in.read(block, 0, Math.min(MAX_BLOCK_SIZE, length));
      length -= MAX_BLOCK_SIZE;
      out.write(block, 0, bytesRead);
    }
  }
@param is InputStream to decode
@param os OutputStream to write fixed version of gif, if needed. (optional)
animated-gif-lite/src/main/java/com/facebook/animated/giflite/decoder/GifMetadataDecoder.java