OSDN Git Service

Coding style fix for local variable
authorHiroshi Miura <miurahr@linux.com>
Mon, 14 Mar 2016 23:20:58 +0000 (08:20 +0900)
committerHiroshi Miura <miurahr@linux.com>
Mon, 14 Mar 2016 23:20:58 +0000 (08:20 +0900)
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
src/org/dict/zip/DictZipInputStream.java

index 6557cc6..54ed6bd 100644 (file)
@@ -105,18 +105,19 @@ public class DictZipInputStream extends InflaterInputStream {
      * reached
      * @exception IOException if an I/O error has occurred or the compressed input data is corrupt
      */
+    @Override
     public final int read(final byte[] buf, final int off, final int size) throws IOException {
         if (eos) {
             return -1;
         }
-        int len = super.read(buf, off, size);
-        if (len == -1) {
+        int readLen = super.read(buf, off, size);
+        if (readLen == -1) {
             //readTrailer();
             eos = true;
         } else {
-            crc.update(buf, off, len);
+            crc.update(buf, off, readLen);
         }
-        return len;
+        return readLen;
     }
 
     /**
@@ -163,6 +164,17 @@ public class DictZipInputStream extends InflaterInputStream {
         return header;
     }
 
+    public void seek(int next) throws IOException {
+        if (in instanceof RandomAccessInputStream) {
+            RandomAccessInputStream rain = (RandomAccessInputStream) in;
+            offset = header.getOffset(next);
+            int pos = header.getPosition(next);
+            rain.seek(pos);
+        } else {
+            throw new IOException("Illegal type of InputStream.");
+        }
+    }
+
     /**
      * Return CRC value set to gzip trailer.
      * @return CRC value.