@Test public void testReadInt() throws Exception { RandomAccessFile file = file(); file.writeInt(100); file.writeInt(-100); file.writeInt(0x12345678); file.seek(0); BufferedFileInput buf = manage(new BufferedFileInput(file, 256)); assertThat(buf.readInt(), is(100)); assertThat(buf.readInt(), is(-100)); assertThat(buf.readInt(), is(0x12345678)); eof(buf); }
@Override public int readInt() throws IOException { byte d3 = read(); byte d2 = read(); byte d1 = read(); byte d0 = read(); return 0 | (d3 << Byte.SIZE * 3) & (0xff << Byte.SIZE * 3) | (d2 << Byte.SIZE * 2) & (0xff << Byte.SIZE * 2) | (d1 << Byte.SIZE * 1) & (0xff << Byte.SIZE * 1) | (d0 << Byte.SIZE * 0) & (0xff << Byte.SIZE * 0) ; }
BufferedFileInput implements RandomAccess, DataInput, Closeable { @Override public int readInt() throws IOException { byte d3 = read(); byte d2 = read(); byte d1 = read(); byte d0 = read(); return 0 | (d3 << Byte.SIZE * 3) & (0xff << Byte.SIZE * 3) | (d2 << Byte.SIZE * 2) & (0xff << Byte.SIZE * 2) | (d1 << Byte.SIZE * 1) & (0xff << Byte.SIZE * 1) | (d0 << Byte.SIZE * 0) & (0xff << Byte.SIZE * 0) ; } }
BufferedFileInput implements RandomAccess, DataInput, Closeable { @Override public int readInt() throws IOException { byte d3 = read(); byte d2 = read(); byte d1 = read(); byte d0 = read(); return 0 | (d3 << Byte.SIZE * 3) & (0xff << Byte.SIZE * 3) | (d2 << Byte.SIZE * 2) & (0xff << Byte.SIZE * 2) | (d1 << Byte.SIZE * 1) & (0xff << Byte.SIZE * 1) | (d0 << Byte.SIZE * 0) & (0xff << Byte.SIZE * 0) ; } BufferedFileInput(RandomAccessFile file, int bufferSize);  BufferedFileInput(RandomAccessFile file, byte[] buffer); }
BufferedFileInput implements RandomAccess, DataInput, Closeable { @Override public int readInt() throws IOException { byte d3 = read(); byte d2 = read(); byte d1 = read(); byte d0 = read(); return 0 | (d3 << Byte.SIZE * 3) & (0xff << Byte.SIZE * 3) | (d2 << Byte.SIZE * 2) & (0xff << Byte.SIZE * 2) | (d1 << Byte.SIZE * 1) & (0xff << Byte.SIZE * 1) | (d0 << Byte.SIZE * 0) & (0xff << Byte.SIZE * 0) ; } BufferedFileInput(RandomAccessFile file, int bufferSize);  BufferedFileInput(RandomAccessFile file, byte[] buffer); void sync(); void seek(long position); long getPosition(); long getSize(); @Override void readFully(byte[] b); @Override void readFully(byte[] b, int off, int len); @Override int skipBytes(int n); @Override boolean readBoolean(); @Override short readShort(); @Override byte readByte(); @Override int readInt(); @Override long readLong(); @Override float readFloat(); @Override double readDouble(); @Override int readUnsignedByte(); @Override int readUnsignedShort(); @Override char readChar(); @Override String readLine(); @Override String readUTF(); @Override void close(); }
BufferedFileInput implements RandomAccess, DataInput, Closeable { @Override public int readInt() throws IOException { byte d3 = read(); byte d2 = read(); byte d1 = read(); byte d0 = read(); return 0 | (d3 << Byte.SIZE * 3) & (0xff << Byte.SIZE * 3) | (d2 << Byte.SIZE * 2) & (0xff << Byte.SIZE * 2) | (d1 << Byte.SIZE * 1) & (0xff << Byte.SIZE * 1) | (d0 << Byte.SIZE * 0) & (0xff << Byte.SIZE * 0) ; } BufferedFileInput(RandomAccessFile file, int bufferSize);  BufferedFileInput(RandomAccessFile file, byte[] buffer); void sync(); void seek(long position); long getPosition(); long getSize(); @Override void readFully(byte[] b); @Override void readFully(byte[] b, int off, int len); @Override int skipBytes(int n); @Override boolean readBoolean(); @Override short readShort(); @Override byte readByte(); @Override int readInt(); @Override long readLong(); @Override float readFloat(); @Override double readDouble(); @Override int readUnsignedByte(); @Override int readUnsignedShort(); @Override char readChar(); @Override String readLine(); @Override String readUTF(); @Override void close();  }