commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1292655 - in /commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan: common/bytesource/ByteSourceInputStream.java formats/tiff/TiffReader.java
Date Thu, 23 Feb 2012 05:38:24 GMT
Author: damjan
Date: Thu Feb 23 05:38:24 2012
New Revision: 1292655

URL: http://svn.apache.org/viewvc?rev=1292655&view=rev
Log:
Fix some issues with skip() functions.


Modified:
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/bytesource/ByteSourceInputStream.java
    commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/bytesource/ByteSourceInputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/bytesource/ByteSourceInputStream.java?rev=1292655&r1=1292654&r2=1292655&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/bytesource/ByteSourceInputStream.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/common/bytesource/ByteSourceInputStream.java
Thu Feb 23 05:38:24 2012
@@ -180,12 +180,7 @@ public class ByteSourceInputStream exten
         }
 
         InputStream is = getInputStream();
-        for (long skipped = 0; skipped < blockStart; ) {
-            long ret = is.skip(blockStart - skipped);
-            if (ret >= 0) {
-                skipped += ret;
-            }
-        }
+        skipBytes(is, blockStart);
 
         byte bytes[] = new byte[blockLength];
         int total = 0;

Modified: commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java?rev=1292655&r1=1292654&r2=1292655&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java
(original)
+++ commons/proper/sanselan/trunk/src/main/java/org/apache/commons/sanselan/formats/tiff/TiffReader.java
Thu Feb 23 05:38:24 2012
@@ -136,24 +136,17 @@ public class TiffReader extends BinaryFi
         InputStream is = null;
         try
         {
-            is = byteSource.getInputStream();
-            if (offset > 0) {
-                for (long skipped = 0; skipped < offset; ) {
-                    long ret = is.skip(offset - skipped);
-                    if (ret >= 0) {
-                        skipped += ret;
-                    }
-                }
-            }
-
-            List<TiffField> fields = new ArrayList<TiffField>();
-
             if (offset >= byteSource.getLength())
             {
                 // Debug.debug("skipping invalid directory!");
                 return true;
             }
 
+            is = byteSource.getInputStream();
+            skipBytes(is, offset);
+
+            List<TiffField> fields = new ArrayList<TiffField>();
+
             int entryCount;
             try
             {



Mime
View raw message