@Override public void close() throws IOException { rais.close(); } }
/** * Return the number of bytes that are available for reading, that is: {@link #getLength()} - {@link #getOffset()} - 1. * Since <code>InputStream.available()</code> returns an int and this method overrides it, a maximum of * <code>Integer.MAX_VALUE</code> can be returned, even if this stream has more bytes available. * * @return the number of bytes that are available for reading. * @throws IOException if something went wrong */ @Override public int available() throws IOException { return (int)(getLength() - getOffset() - 1); }
assert tempFile.getSize() == rais.getLength(); rais.close(); assert -1 == rais.read(); byte b[] = new byte[1]; assert -1 == rais.read(b); assert -1 == rais.read(b, 0, 1); try { rais.readFully(b); } catch(EOFException e) { eofExceptionThrown = true; try { rais.readFully(b, 0, 1); } catch(EOFException e) { eofExceptionThrown = true; rais.close();
int len = rais.available(); rais.seek(len - i); if (rais.read(buffer, 0, (i == 7) ? 4 : 12) == -1) throw new IOException("unable to read tail of nrg file"); rais.seek(offset); if (rais.read(buffer, 0, 8) == -1) throw new IOException("unable to read chunk in tail of nrg file"); if (rais.read(buffer, 0, (int) clen) == -1) throw new IOException("unable to read chunk in tail of nrg file"); if (rais.read(buffer, 0, 4) == -1) throw new IOException("unable to skip endian in DAO chunk"); if (rais.read(buffer, 0, (int) clen) == -1) throw new IOException("unable to read DAO chunk"); rais.seek(offset); if (rais.read(buffer, 0, (int) clen) == -1) throw new IOException("unable to read CUEX chunk"); rais.seek(offset); } else {
/** * Overrides <code>InputStream.mark()</code> to provide a working implementation of the method. * * @throws IOException if something went wrong */ @Override public synchronized void reset() throws IOException { seek(this.markOffset); }
@Override public int read() throws IOException { return rais.read(); }
rais.readFully(signatureBytes); long sig = ZipLong.getValue(signatureBytes); final long cfhSig = ZipLong.getValue(CFH_SIG); entryInfo.centralHeaderOffset = rais.getOffset() - 4; // 4 for the header signature rais.readFully(cfh); ZipEntry ze = new ZipEntry(); rais.readFully(filename); rais.readFully(extra); ze.setExtra(extra); rais.readFully(comment); rais.readFully(signatureBytes); sig = ZipLong.getValue(signatureBytes);
public long getLength() throws IOException { return rais.getLength(); }
public long getOffset() throws IOException { return rais.getOffset(); }
public void seek(long offset) throws IOException { rais.seek(offset); } }
@Override public int read() throws IOException { return rais.read(); }
/** * Overrides <code>InputStream.mark()</code> to provide a working implementation of the method. The given readLimit * is simply ignored, the stream can be repositionned using {@link #reset()} with no limit on the number of bytes * read after <code>mark()</code> has been called. * * @param readLimit this parameter has no effect and is simply ignored */ @Override public synchronized void mark(int readLimit) { try { this.markOffset = getOffset(); } catch (IOException e) { LOGGER.info("Caught exception", e); } }
@Override public int read(byte[] b, int off, int len) throws IOException { if (remaining <= 0) { if (addDummyByte) { addDummyByte = false; b[off] = 0; return 1; } return -1; } if (len <= 0) { return 0; } if (len > remaining) { len = (int) remaining; } int ret; synchronized (rais) { rais.seek(loc); ret = rais.read(b, off, len); } if (ret > 0) { loc += ret; remaining -= ret; } return ret; }
rais.seek(IsoUtil.offsetInSector(extent - sector_offset, sectSize, false) + shiftOffset); StreamUtils.readFully(rais, buffer); len -= buffer.length;
/** * Closes the ISO file's {@link RandomAccessInputStream} that was passed to the constructor. * * @throws IOException if an I/O error occurs while closing the stream */ @Override public void close() throws IOException { rais.close(); } }