/** * Reads a byte from the current tar archive entry. * * This method simply calls read(byte[], int, int). * * @return The byte read, or -1 at EOF. * @throws IOException on error */ @Override public int read() throws IOException { int num = read(oneBuf, 0, 1); return num == -1 ? -1 : (oneBuf[0]) & BYTE_MASK; }
/** * Copies the contents of the current tar archive entry directly into * an output stream. * * @param out The OutputStream into which to write the entry's data. * @throws IOException on error */ public void copyEntryContents(OutputStream out) throws IOException { byte[] buf = new byte[LARGE_BUFFER_SIZE]; while (true) { int numRead = read(buf, 0, buf.length); if (numRead == -1) { break; } out.write(buf, 0, numRead); } }
while ((length = read(SMALL_BUF)) >= 0) { longName.write(SMALL_BUF, 0, length);
int realSkip = (int) (skip > SKIP_BUF.length ? SKIP_BUF.length : skip); int numRead = read(SKIP_BUF, 0, realSkip); if (numRead == -1) { break;