public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return 0; } if (rangePosition >= length) { close(); return -1; } int elen = Math.min(len, length - rangePosition); raf.readFully(b, off, elen); rangePosition += elen; return elen; }
/** * Extracts a revision from the document. * * @param field the signature field name * @return an <CODE>InputStream</CODE> covering the revision. Returns <CODE>null</CODE> if * it's not a signature field * @throws IOException on error */ public InputStream extractRevision(String field) throws IOException { getSignatureNames(); field = getTranslatedFieldName(field); if (!sigNames.containsKey(field)) return null; int length = ((int[])sigNames.get(field))[0]; RandomAccessFileOrArray raf = reader.getSafeFile(); raf.reOpen(); raf.seek(0); return new RevisionStream(raf, length); }
/** * Extracts a revision from the document. * * @param field the signature field name * @return an <CODE>InputStream</CODE> covering the revision. Returns <CODE>null</CODE> if * it's not a signature field * @throws IOException on error */ public InputStream extractRevision(String field) throws IOException { getSignatureNames(); field = getTranslatedFieldName(field); if (!sigNames.containsKey(field)) return null; int length = ((int[])sigNames.get(field))[0]; RandomAccessFileOrArray raf = reader.getSafeFile(); raf.reOpen(); raf.seek(0); return new RevisionStream(raf, length); }
/** * Extracts a revision from the document. * * @param field the signature field name * @return an <CODE>InputStream</CODE> covering the revision. Returns <CODE>null</CODE> if it's not a signature field * @throws IOException on error */ public InputStream extractRevision(String field) throws IOException { getSignatureNames(); field = getTranslatedFieldName(field); if (!sigNames.containsKey(field)) { return null; } int length = sigNames.get(field)[0]; RandomAccessFileOrArray raf = reader.getSafeFile(); raf.reOpen(); raf.seek(0); return new RevisionStream(raf, length); }
public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return 0; } if (rangePosition >= length) { close(); return -1; } int elen = Math.min(len, length - rangePosition); raf.readFully(b, off, elen); rangePosition += elen; return elen; }
public int read(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); } else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } else if (len == 0) { return 0; } if (rangePosition >= length) { close(); return -1; } int elen = Math.min(len, length - rangePosition); raf.readFully(b, off, elen); rangePosition += elen; return elen; }
public int read() throws IOException { int n = read(b); if (n != 1) { return -1; } return b[0] & 0xff; }
public int read() throws IOException { int n = read(b); if (n != 1) return -1; return b[0] & 0xff; }
public int read() throws IOException { int n = read(b); if (n != 1) return -1; return b[0] & 0xff; }