/** * 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.readShort(stream); }
/** * 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" ); } }
/** * 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.readShort(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 { _value = LittleEndian.readShort(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.readShort(stream); }
/** * 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" ); } }