public int read() throws IOException { if (!ensureBuffer()) { return -1; } int r = raw.read(); position++; expectedRawPosition++; blockBytesRead++; return r; }
public int read(byte[] b, int ofs, int len) throws IOException { if (!ensureBuffer()) { return 0; } int rem = BLOCK_SIZE - (int)(position % BLOCK_SIZE); len = Math.min(len, rem); int c = raw.read(b, ofs, len); position += c; expectedRawPosition += c; blockBytesRead++; return len; }
/** * Skips over any property information that may precede a piece table. * These property structures contain stylesheet information that applies * to the piece table. Since we're only interested in the text itself, * we just ignore this property stuff. (I suppose a third buffered * stream could be used to add style information to {@link Piece}, but * we don't need it.) * * @param input the input stream containing the piece table * @throws IOException if an IO error occurs */ private static void skipProperties(SeekInputStream input) throws IOException { int tag = input.read(); while (tag == 1) { int size = Endian.littleChar(input); while (size > 0) { size -= input.skip(size); } tag = input.read(); } if (tag != 2) { throw new IllegalStateException(); } }
public int read() throws IOException { seekIfNecessary(); if (doc == null) { throw new IOException("Stream closed."); } if (charPos >= table.getMaxCharPos()) { return -1; } int ch; if (unicode) { ch = Endian.littleChar(doc); } else { ch = Cp1252.decode(doc.read()); } charPos++; return ch; }
@Override public int read(byte[] buf) throws IOException { return input.read(buf); }
@Override public int read() throws IOException { return input.read(); }
@Override public int read() throws IOException { return input.read(); }
@Override public int read(byte[] buf, int ofs, int len) throws IOException { return input.read(buf, ofs, len); }
@Override public int read(byte[] buf) throws IOException { return input.read(buf); }
@Override public int read() throws IOException { return input.read(); }
@Override public int read() throws IOException { ensure(); int c = input.read(); if (c >= 0) { expected++; } return c; }
@Override public int read(byte[] buf, int ofs, int len) throws IOException { ensure(); int r = input.read(buf, ofs, len); if (r > 0) { expected += r; } return r; }
@Override public int read() throws IOException { ensure(); int c = input.read(); if (c >= 0) { expected++; } return c; }
@Override public int read() throws IOException { ensure(); int c = input.read(); if (c >= 0) { expected++; } return c; }
public int read() throws IOException { if (!ensureBuffer()) { return -1; } int r = raw.read(); position++; expectedRawPosition++; blockBytesRead++; return r; }
public int read(byte[] b, int ofs, int len) throws IOException { if (!ensureBuffer()) { return 0; } int rem = BLOCK_SIZE - (int)(position % BLOCK_SIZE); len = Math.min(len, rem); int c = raw.read(b, ofs, len); position += c; expectedRawPosition += c; blockBytesRead++; return len; }
@Override public int read(byte[] buf) throws IOException { ensure(); int r = input.read(buf); if (r > 0) { expected += r; } return r; }
@Override public int read(byte[] buf) throws IOException { ensure(); int r = input.read(buf); if (r > 0) { expected += r; } return r; }
@Override public int read(byte[] buf, int ofs, int len) throws IOException { ensure(); int r = input.read(buf, ofs, len); if (r > 0) { expected += r; } return r; }
@Override public int read(byte[] buf) throws IOException { ensure(); int r = input.read(buf); if (r > 0) { expected += r; } return r; }