@Override public int read(byte[] b, int off, int len) throws IOException { if ((off | len | (off + len) | (b.length - (off + len))) < 0) { throw new IndexOutOfBoundsException(); } if (!checkEOF()) { int n = Math.min(remain, len); int ret = in.read(b, off, n); if (ret < 0) throw new IOException("Corrupted chunk encoding stream"); remain -= ret; return ret; } return -1; }
@Override public int read() throws IOException { if (checkEOF()) return -1; int ret = in.read(); if (ret < 0) throw new IOException("Corrupted chunk encoding stream"); --remain; return ret; }
@Override public long skip(long n) throws IOException { if (!checkEOF()) { long ret = in.skip(Math.min(remain, n)); remain -= ret; return ret; } return 0; }
/** * How many bytes remain in the current chunk? * * @return remaining bytes left in the current chunk. * @throws java.io.IOException */ public int getRemain() throws IOException { checkEOF(); return remain; }
/** * How many bytes remain in the current chunk? * * @return remaining bytes left in the current chunk. * @throws java.io.IOException */ public int getRemain() throws IOException { checkEOF(); return remain; }
/** * Have we reached the last chunk. * * @return true if we have reached the last chunk. * @throws java.io.IOException */ public boolean isLastChunk() throws IOException { checkEOF(); return lastChunk; }
@Override public long skip(long n) throws IOException { if (!checkEOF()) { long ret = in.skip(Math.min(remain, n)); remain -= ret; return ret; } return 0; }
@Override public int read() throws IOException { if (checkEOF()) return -1; int ret = in.read(); if (ret < 0) throw new IOException("Corrupted chunk encoding stream"); --remain; return ret; }
/** * How many bytes remain in the current chunk? * * @return remaining bytes left in the current chunk. * @throws java.io.IOException */ public int getRemain() throws IOException { checkEOF(); return remain; }
/** * Have we reached the last chunk. * * @return true if we have reached the last chunk. * @throws java.io.IOException */ public boolean isLastChunk() throws IOException { checkEOF(); return lastChunk; }
@Override public long skip(long n) throws IOException { if (!checkEOF()) { long ret = in.skip(Math.min(remain, n)); remain -= ret; return ret; } return 0; }
/** * How many bytes remain in the current chunk? * * @return remaining bytes left in the current chunk. * @throws java.io.IOException */ public int getRemain() throws IOException { checkEOF(); return remain; }
/** * Have we reached the last chunk. * * @return true if we have reached the last chunk. * @throws java.io.IOException */ public boolean isLastChunk() throws IOException { checkEOF(); return lastChunk; }
@Override public long skip(long n) throws IOException { if (!checkEOF()) { long ret = in.skip(Math.min(remain, n)); remain -= ret; return ret; } return 0; }
/** * How many bytes remain in the current chunk? * * @return remaining bytes left in the current chunk. * @throws java.io.IOException */ public int getRemain() throws IOException { checkEOF(); return remain; }
@Override public int read() throws IOException { if (checkEOF()) return -1; int ret = in.read(); if (ret < 0) throw new IOException("Corrupted chunk encoding stream"); --remain; return ret; }
@Override public int read() throws IOException { if (checkEOF()) return -1; int ret = in.read(); if (ret < 0) throw new IOException("Corrupted chunk encoding stream"); --remain; return ret; }
@Override public void close() throws IOException { if (closed == false) { try { while (!checkEOF()) { skip(Integer.MAX_VALUE); } } finally { closed = true; } } } }
/** * Have we reached the last chunk. * * @return true if we have reached the last chunk. * @throws java.io.IOException */ public boolean isLastChunk() throws IOException { checkEOF(); return lastChunk; }
/** * How many bytes remain in the current chunk? * * @return remaining bytes left in the current chunk. * @throws java.io.IOException */ public int getRemain() throws IOException { checkEOF(); return remain; }