@Test public void testGetInt() throws Exception { block.setBigEndian(true); DataConverter conv = new BigEndianDataConverter(); for (int i = 0; i < 20; i++) { byte[] b = new byte[4]; System.arraycopy(buf, i + 4, b, 0, b.length); assertEquals(conv.getInt(b), block.getInt(BigInteger.valueOf(i + 4))); } block.setBigEndian(false); conv = new LittleEndianDataConverter(); for (int i = 0; i < 12; i++) { byte[] b = new byte[4]; System.arraycopy(buf, i + 4, b, 0, b.length); assertEquals(conv.getInt(b), block.getInt(BigInteger.valueOf(i + 4))); } }
public int getInt(BigInteger bigIndex) throws ByteBlockAccessException { int index = bigIndex.intValue(); if (index < buf.length) { byte[] b = new byte[4]; System.arraycopy(buf, index, b, 0, b.length); return converter.getInt(b); } return 0; }
FileByteBlock implements ByteBlock { public int getInt(BigInteger bigIndex) throws ByteBlockAccessException { int index = bigIndex.intValue(); if (index < buf.length) { byte[] b = new byte[4]; System.arraycopy(buf, index, b, 0, b.length); return converter.getInt(b); } return 0; } }
FileByteBlock implements ByteBlock { public int getInt(BigInteger bigIndex) throws ByteBlockAccessException { int index = bigIndex.intValue(); if (index < buf.length) { byte[] b = new byte[4]; System.arraycopy(buf, index, b, 0, b.length); return converter.getInt(b); } return 0; } FileByteBlock(byte[] b); }
FileByteBlock implements ByteBlock { public int getInt(BigInteger bigIndex) throws ByteBlockAccessException { int index = bigIndex.intValue(); if (index < buf.length) { byte[] b = new byte[4]; System.arraycopy(buf, index, b, 0, b.length); return converter.getInt(b); } return 0; } FileByteBlock(byte[] b); String getLocationRepresentation(BigInteger bigIndex); int getMaxLocationRepresentationSize(); String getIndexName(); BigInteger getLength(); byte getByte(BigInteger bigIndex); int getInt(BigInteger bigIndex); long getLong(BigInteger bigIndex); void setByte(BigInteger bigIndex, byte value); void setInt(BigInteger bigIndex, int value); void setLong(BigInteger bigIndex, long value); boolean isEditable(); void setBigEndian(boolean bigEndian); boolean isBigEndian(); int getAlignment(int radix); }
FileByteBlock implements ByteBlock { public int getInt(BigInteger bigIndex) throws ByteBlockAccessException { int index = bigIndex.intValue(); if (index < buf.length) { byte[] b = new byte[4]; System.arraycopy(buf, index, b, 0, b.length); return converter.getInt(b); } return 0; } FileByteBlock(byte[] b); String getLocationRepresentation(BigInteger bigIndex); int getMaxLocationRepresentationSize(); String getIndexName(); BigInteger getLength(); byte getByte(BigInteger bigIndex); int getInt(BigInteger bigIndex); long getLong(BigInteger bigIndex); void setByte(BigInteger bigIndex, byte value); void setInt(BigInteger bigIndex, int value); void setLong(BigInteger bigIndex, long value); boolean isEditable(); void setBigEndian(boolean bigEndian); boolean isBigEndian(); int getAlignment(int radix);  }