예제 #1
0
 public final long read(Buffer buffer, long l) throws IOException {
   if (l < 0L) {
     throw new IllegalArgumentException(
         (new StringBuilder("byteCount < 0: ")).append(l).toString());
   }
   if (l == 0L) {
     return 0L;
   }
   if (section == 0) {
     consumeHeader();
     section = 1;
   }
   if (section == 1) {
     long l1 = buffer.size;
     l = inflaterSource.read(buffer, l);
     if (l != -1L) {
       updateCrc(buffer, l1, l);
       return l;
     }
     section = 2;
   }
   if (section == 2) {
     consumeTrailer();
     section = 3;
     if (!source.exhausted()) {
       throw new IOException("gzip finished without exhausting source");
     }
   }
   return -1L;
 }
예제 #2
0
 public final void close() throws IOException {
   inflaterSource.close();
 }