/** * 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; }
int flags = Endian.littleChar(mainStream); boolean complex = (flags & 0x0004) == 0x0004; boolean tableOne = (flags & 0x0200) == 0x0200;
/** * Reads the next little-endian signed 16-bit integer from the * given stream. * * @param input the input stream to read from * @return the next 16-bit little-endian integer * @throws IOException if an IO error occurs */ public static short littleShort(InputStream input) throws IOException { return (short)littleChar(input); }
/** * Reads the next little-endian signed 16-bit integer from the * given stream. * * @param input the input stream to read from * @return the next 16-bit little-endian integer * @throws IOException if an IO error occurs */ public static short littleShort(InputStream input) throws IOException { return (short)littleChar(input); }
/** * Reads the next little-endian signed 16-bit integer from the * given stream. * * @param input the input stream to read from * @return the next 16-bit little-endian integer * @throws IOException if an IO error occurs */ public static short littleShort(InputStream input) throws IOException { return (short)littleChar(input); }
/** * Reads the next little-endian signed 32-bit integer from the * given stream. * * @param input the input stream to read from * @return the next 32-bit little-endian integer * @throws IOException if an IO error occurs */ public static int littleInt(InputStream input) throws IOException { char lo = littleChar(input); char hi = littleChar(input); return (hi << 16) | lo; }
/** * Reads the next little-endian signed 32-bit integer from the * given stream. * * @param input the input stream to read from * @return the next 32-bit little-endian integer * @throws IOException if an IO error occurs */ public static int littleInt(InputStream input) throws IOException { char lo = littleChar(input); char hi = littleChar(input); return (hi << 16) | lo; }
/** * Reads the next little-endian signed 32-bit integer from the * given stream. * * @param input the input stream to read from * @return the next 32-bit little-endian integer * @throws IOException if an IO error occurs */ public static int littleInt(InputStream input) throws IOException { char lo = littleChar(input); char hi = littleChar(input); return (hi << 16) | lo; }
/** * 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; }
int flags = Endian.littleChar(mainStream); boolean complex = (flags & 0x0004) == 0x0004; boolean tableOne = (flags & 0x0200) == 0x0200;