- /**
- * Checks if current bitmaps exceed the maximum OpenGL texture size limit
- * @param bitmap
- * @return boolean
- */
- private boolean checkIfMaximumBitmapExceed(Bitmap bitmap) {
- if (bitmap.getWidth() > MAX_OPENGL_TEXTURE_WIDTH
- || bitmap.getHeight() > MAX_OPENGL_TEXTURE_HEIGHT) {
- return true;
+ static class FlushedInputStream extends FilterInputStream {
+ public FlushedInputStream(InputStream inputStream) {
+ super(inputStream);
+ }
+
+ @Override
+ public long skip(long n) throws IOException {
+ long totalBytesSkipped = 0L;
+ while (totalBytesSkipped < n) {
+ long bytesSkipped = in.skip(n - totalBytesSkipped);
+ if (bytesSkipped == 0L) {
+ int byteValue = read();
+ if (byteValue < 0) {
+ break; // we reached EOF
+ } else {
+ bytesSkipped = 1; // we read one byte
+ }
+ }
+ totalBytesSkipped += bytesSkipped;
+ }
+ return totalBytesSkipped;