/** * set the value from an InputStream * * @param stream the InputStream from which the value is to be * read * * @exception BufferUnderrunException if there is not enough data * available from the InputStream * @exception IOException if an IOException is thrown from reading * the InputStream */ public void readFromStream(final InputStream stream) throws IOException { _value = LittleEndian.readInt(stream); }
/** * get an unsigned int value from an InputStream * * @param stream * the InputStream from which the int is to be read * @return the unsigned int (32-bit) value * @exception IOException * will be propagated back to the caller * @exception BufferUnderrunException * if the stream cannot provide enough bytes */ public static long readUInt( InputStream stream ) throws IOException, BufferUnderrunException { long retNum = readInt(stream); return retNum & 0x00FFFFFFFFl; }
/** * Dumps out a hex value by reading from a input stream. * * @param bytes How many bytes this hex value consists of. * @param in The stream to read the hex value from. * @param out The stream to write the nicely formatted hex value to. */ private void outHex( int bytes, InputStream in, PrintStream out ) throws IOException, LittleEndian.BufferUnderrunException { switch ( bytes ) { case 1: out.print( HexDump.toHex( (byte) in.read() ) ); break; case 2: out.print( HexDump.toHex( LittleEndian.readShort( in ) ) ); break; case 4: out.print( HexDump.toHex( LittleEndian.readInt( in ) ) ); break; default: throw new IOException( "Unable to output variable of that width" ); } }
options = LittleEndian.readShort( in ); recordId = LittleEndian.readShort( in ); recordBytesRemaining = LittleEndian.readInt( in ); int n32; n16 = LittleEndian.readShort( in ); n32 = LittleEndian.readInt( in ); out.print( LittleEndian.readInt( in ) ); out.print( " ShapeID A: " ); out.print( LittleEndian.readInt( in ) ); out.print( " ShapeID B: " ); out.print( LittleEndian.readInt( in ) ); out.print( " ShapeID connector: " ); out.print( LittleEndian.readInt( in ) ); out.print( " Connect pt A: " ); out.print( LittleEndian.readInt( in ) ); out.print( " Connect pt B: " ); out.println( LittleEndian.readInt( in ) ); out.println( " Cache of size: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); out.println( " Boundary top: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); out.println( " Boundary left: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); out.println( " Boundary width: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); out.println( " Boundary height: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); out.println( " X: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); out.println( " Y: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); out.println( " Cache of saved size: " + HexDump.toHex( LittleEndian.readInt( in ) ) ); out.println( " Compression Flag: " + HexDump.toHex( (byte) in.read() ) );
/** * set the value from an InputStream * * @param stream the InputStream from which the value is to be * read * * @exception BufferUnderrunException if there is not enough data * available from the InputStream * @exception IOException if an IOException is thrown from reading * the InputStream */ public void readFromStream(final InputStream stream) throws IOException { _value = LittleEndian.readInt(stream); }
/** * set the value from an InputStream * * @param stream the InputStream from which the value is to be * read * * @exception BufferUnderrunException if there is not enough data * available from the InputStream * @exception IOException if an IOException is thrown from reading * the InputStream */ public void readFromStream(final InputStream stream) throws IOException, BufferUnderrunException { _value = LittleEndian.readInt(stream); }
/** * set the value from an InputStream * * @param stream the InputStream from which the value is to be * read * * @exception BufferUnderrunException if there is not enough data * available from the InputStream * @exception IOException if an IOException is thrown from reading * the InputStream */ public void readFromStream(final InputStream stream) throws IOException, BufferUnderrunException { _value = LittleEndian.readInt(stream); }
/** * get an unsigned int value from an InputStream * * @param stream * the InputStream from which the int is to be read * @return the unsigned int (32-bit) value * @exception IOException * will be propagated back to the caller * @exception BufferUnderrunException * if the stream cannot provide enough bytes */ public static long readUInt( InputStream stream ) throws IOException, BufferUnderrunException { long retNum = readInt(stream); return retNum & 0x00FFFFFFFFl; }
/** * get an unsigned int value from an InputStream * * @param stream * the InputStream from which the int is to be read * @return the unsigned int (32-bit) value * @exception IOException * will be propagated back to the caller * @exception BufferUnderrunException * if the stream cannot provide enough bytes */ public static long readUInt( InputStream stream ) throws IOException, BufferUnderrunException { long retNum = readInt(stream); return retNum & 0x00FFFFFFFFl; }
public HMEFDumper(InputStream inp) throws IOException { this.inp = inp; // Check the signature matches long sig = LittleEndian.readInt(inp); if(sig != HMEFMessage.HEADER_SIGNATURE) { throw new IllegalArgumentException( "TNEF signature not detected in file, " + "expected " + HMEFMessage.HEADER_SIGNATURE + " but got " + sig ); } // Skip over the File ID LittleEndian.readUShort(inp); }
public HMEFDumper(InputStream inp) throws IOException { this.inp = inp; // Check the signature matches int sig = LittleEndian.readInt(inp); if(sig != HMEFMessage.HEADER_SIGNATURE) { throw new IllegalArgumentException( "TNEF signature not detected in file, " + "expected " + HMEFMessage.HEADER_SIGNATURE + " but got " + sig ); } // Skip over the File ID LittleEndian.readUShort(inp); }
public HMEFMessage(InputStream inp) throws IOException { // Check the signature matches long sig = LittleEndian.readInt(inp); if(sig != HEADER_SIGNATURE) { throw new IllegalArgumentException( "TNEF signature not detected in file, " + "expected " + HEADER_SIGNATURE + " but got " + sig ); } // Read the File ID fileId = LittleEndian.readUShort(inp); // Now begin processing the contents process(inp, 0); }
public HMEFMessage(InputStream inp) throws IOException { try { // Check the signature matches int sig = LittleEndian.readInt(inp); if (sig != HEADER_SIGNATURE) { throw new IllegalArgumentException( "TNEF signature not detected in file, " + "expected " + HEADER_SIGNATURE + " but got " + sig ); } // Read the File ID fileId = LittleEndian.readUShort(inp); // Now begin processing the contents process(inp); } finally { inp.close(); } }
private static int getLength(MAPIType type, InputStream inp) throws IOException { if (type.isFixedLength()) { return type.getLength(); } if (type == Types.ASCII_STRING || type == Types.UNICODE_STRING || type == Types.DIRECTORY || type == Types.BINARY) { // Need to read the length, as it varies return LittleEndian.readInt(inp); } else { throw new IllegalArgumentException("Unknown type " + type); } } private static void skipToBoundary(int length, InputStream inp) throws IOException {
/** * Dumps out a hex value by reading from a input stream. * * @param bytes How many bytes this hex value consists of. * @param in The stream to read the hex value from. * @param out The stream to write the nicely formatted hex value to. */ private void outHex( int bytes, InputStream in, PrintStream out ) throws IOException, LittleEndian.BufferUnderrunException { switch ( bytes ) { case 1: out.print( HexDump.toHex( (byte) in.read() ) ); break; case 2: out.print( HexDump.toHex( LittleEndian.readShort( in ) ) ); break; case 4: out.print( HexDump.toHex( LittleEndian.readInt( in ) ) ); break; default: throw new IOException( "Unable to output variable of that width" ); } }
/** * Dumps out a hex value by reading from a input stream. * * @param bytes How many bytes this hex value consists of. * @param in The stream to read the hex value from. * @param out The stream to write the nicely formatted hex value to. */ private void outHex( int bytes, InputStream in, PrintStream out ) throws IOException, LittleEndian.BufferUnderrunException { switch ( bytes ) { case 1: out.print( HexDump.toHex( (byte) in.read() ) ); break; case 2: out.print( HexDump.toHex( LittleEndian.readShort( in ) ) ); break; case 4: out.print( HexDump.toHex( LittleEndian.readInt( in ) ) ); break; default: throw new IOException( "Unable to output variable of that width" ); } }
/** * Dumps out a hex value by reading from a input stream. * * @param bytes How many bytes this hex value consists of. * @param in The stream to read the hex value from. * @param out The stream to write the nicely formatted hex value to. */ private void outHex( int bytes, InputStream in, PrintStream out ) throws IOException, LittleEndian.BufferUnderrunException { switch ( bytes ) { case 1: out.print( HexDump.toHex( (byte) in.read() ) ); break; case 2: out.print( HexDump.toHex( LittleEndian.readShort( in ) ) ); break; case 4: out.print( HexDump.toHex( LittleEndian.readInt( in ) ) ); break; default: throw new IOException( "Unable to output variable of that width" ); } }
/** * Constructs a single new attribute from the id, type, * and the contents of the stream */ protected TNEFAttribute(int id, int type, InputStream inp) throws IOException { this.type = type; int length = LittleEndian.readInt(inp); property = TNEFProperty.getBest(id, type); data = new byte[length]; IOUtils.readFully(inp, data); checksum = LittleEndian.readUShort(inp); }
/** * Constructs a single new attribute from the id, type, * and the contents of the stream */ protected TNEFAttribute(int id, int type, InputStream inp) throws IOException { this.type = type; int length = LittleEndian.readInt(inp); property = TNEFProperty.getBest(id, type); data = IOUtils.safelyAllocate(length, MAX_RECORD_LENGTH); IOUtils.readFully(inp, data); checksum = LittleEndian.readUShort(inp); }
int peOffset = LittleEndian.readInt(stream);