/** * Get a LE short value from an InputStream * * @param stream the InputStream from which the short is to be read * @return the short (16-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static short readShortLE(InputStream stream) throws IOException, BufferUnderrunException { return (short) readUShortLE(stream); }
private int readUShort(InputStream is) throws IOException { try { return EndianUtils.readUShortLE(is); } catch (EndianUtils.BufferUnderrunException e) { throw new IOException(e); } }
private String read2007and2010String(InputStream stream) throws IOException, TikaException { int stringLen = EndianUtils.readUShortLE(stream); byte[] stringData = new byte[stringLen * 2]; IOUtils.readFully(stream, stringData); String value = StringUtil.getFromUnicodeLE(stringData); // Some strings are null terminated if(value.charAt(value.length()-1) == 0) { value = value.substring(0, value.length()-1); } return value; }
private void handleNoteText(InputStream stream, XHTMLContentHandler xhtml) throws IOException, SAXException, TikaException { // Ensure we have the right padding text int read; for(int i=0; i<10; i++) { read = stream.read(); if(read >= 0 && read <= 0x0f) { // Promising } else { // Wrong, false detection return; } } read = stream.read(); if(read != 0x1f) { // Wrong, false detection return; } int length = EndianUtils.readUShortLE(stream); if(length <= MAX_SANE_TEXT_LENGTH) { // Length sanity check passed handleText(length, stream, xhtml); } }
private String read2004String(InputStream stream) throws IOException, TikaException { int stringLen = EndianUtils.readUShortLE(stream); byte[] stringData = new byte[stringLen]; IOUtils.readFully(stream, stringData); // Often but not always null terminated if (stringData[stringLen-1] == 0) { stringLen--; } String value = StringUtil.getFromCompressedUnicode(stringData, 0, stringLen); return value; }
int count = EndianUtils.readUShortLE(stream);
int propCount = 0; while(propCount < 30) { int propIdx = EndianUtils.readUShortLE(stream); int length = EndianUtils.readUShortLE(stream); int valueType = stream.read();
throws IOException, SAXException, TikaException { int maybeLength = EndianUtils.readUShortLE(stream); if(maybeLength == 0) {
/** * Get a LE short value from an InputStream * * @param stream the InputStream from which the short is to be read * @return the short (16-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static short readShortLE(InputStream stream) throws IOException, BufferUnderrunException { return (short) readUShortLE(stream); }
/** * Get a LE short value from an InputStream * * @param stream the InputStream from which the short is to be read * @return the short (16-bit) value * @throws IOException will be propagated back to the caller * @throws BufferUnderrunException if the stream cannot provide enough bytes */ public static short readShortLE(InputStream stream) throws IOException, BufferUnderrunException { return (short) readUShortLE(stream); }
private int readUShort(InputStream is) throws IOException { try { return EndianUtils.readUShortLE(is); } catch (EndianUtils.BufferUnderrunException e) { throw new IOException(e); } }
private int readUShort(InputStream is) throws IOException { try { return EndianUtils.readUShortLE(is); } catch (EndianUtils.BufferUnderrunException e) { throw new IOException(e); } }
private String read2007and2010String(InputStream stream) throws IOException, TikaException { int stringLen = EndianUtils.readUShortLE(stream); byte[] stringData = new byte[stringLen * 2]; IOUtils.readFully(stream, stringData); String value = StringUtil.getFromUnicodeLE(stringData); // Some strings are null terminated if(value.charAt(value.length()-1) == 0) { value = value.substring(0, value.length()-1); } return value; }
private String read2007and2010String(InputStream stream) throws IOException, TikaException { int stringLen = EndianUtils.readUShortLE(stream); byte[] stringData = new byte[stringLen * 2]; IOUtils.readFully(stream, stringData); String value = StringUtil.getFromUnicodeLE(stringData); // Some strings are null terminated if(value.charAt(value.length()-1) == 0) { value = value.substring(0, value.length()-1); } return value; }
type = EndianUtils.readUShortLE(stream); } else { type = EndianUtils.readUShortBE(stream); machine = EndianUtils.readUShortLE(stream); } else { machine = EndianUtils.readUShortBE(stream);
private void handleNoteText(InputStream stream, XHTMLContentHandler xhtml) throws IOException, SAXException, TikaException { // Ensure we have the right padding text int read; for(int i=0; i<10; i++) { read = stream.read(); if(read >= 0 && read <= 0x0f) { // Promising } else { // Wrong, false detection return; } } read = stream.read(); if(read != 0x1f) { // Wrong, false detection return; } int length = EndianUtils.readUShortLE(stream); if(length <= MAX_SANE_TEXT_LENGTH) { // Length sanity check passed handleText(length, stream, xhtml); } }
private void handleNoteText(InputStream stream, XHTMLContentHandler xhtml) throws IOException, SAXException, TikaException { // Ensure we have the right padding text int read; for(int i=0; i<10; i++) { read = stream.read(); if(read >= 0 && read <= 0x0f) { // Promising } else { // Wrong, false detection return; } } read = stream.read(); if(read != 0x1f) { // Wrong, false detection return; } int length = EndianUtils.readUShortLE(stream); if(length <= MAX_SANE_TEXT_LENGTH) { // Length sanity check passed handleText(length, stream, xhtml); } }
private String read2004String(InputStream stream) throws IOException, TikaException { int stringLen = EndianUtils.readUShortLE(stream); byte[] stringData = new byte[stringLen]; IOUtils.readFully(stream, stringData); // Often but not always null terminated if (stringData[stringLen-1] == 0) { stringLen--; } String value = StringUtil.getFromCompressedUnicode(stringData, 0, stringLen); return value; }
private String read2004String(InputStream stream) throws IOException, TikaException { int stringLen = EndianUtils.readUShortLE(stream); byte[] stringData = new byte[stringLen]; IOUtils.readFully(stream, stringData); // Often but not always null terminated if (stringData[stringLen-1] == 0) { stringLen--; } String value = StringUtil.getFromCompressedUnicode(stringData, 0, stringLen); return value; }
int count = EndianUtils.readUShortLE(stream);