@Test public void testRead() throws IOException { assertEquals(test.mocksize, test.size); byte[] write = new byte[test.recordSize]; random.nextBytes(write); try { test.append(write); } catch (IOException e) { e.printStackTrace(); fail("unexpected exception: " + e); } assertEquals(write.length + test.mocksize, test.size); assertTrue(test.recordCt == 1); byte[] read = test.read(0); assertTrue(write.length == read.length); assertArrayEquals(write, read); }
public byte[] read(long record) throws IOException { long pos = record * recordSize + recordSize; if (pos >= size) { final String fmt = "bad seek to position: %d (size is %d)"; final String msg = format(fmt, pos, size); throw new InvalidArgument(msg); } raf.seek(pos); byte[] ret = new byte[recordSize]; int read = raf.read(ret); if (read != recordSize) { final String fmt = "read %d bytes, but expected %d"; final String msg = format(fmt, read, recordSize); throw new InvalidArgument(msg); } return ret; }
RecordFile implements Iterable<byte[]> { public byte[] read(long record) throws IOException { long pos = record * recordSize + recordSize; if (pos >= size) { final String fmt = "bad seek to position: %d (size is %d)"; final String msg = format(fmt, pos, size); throw new InvalidArgument(msg); } raf.seek(pos); byte[] ret = new byte[recordSize]; int read = raf.read(ret); if (read != recordSize) { final String fmt = "read %d bytes, but expected %d"; final String msg = format(fmt, read, recordSize); throw new InvalidArgument(msg); } return ret; } }
RecordFile implements Iterable<byte[]> { public byte[] read(long record) throws IOException { long pos = record * recordSize + recordSize; if (pos >= size) { final String fmt = "bad seek to position: %d (size is %d)"; final String msg = format(fmt, pos, size); throw new InvalidArgument(msg); } raf.seek(pos); byte[] ret = new byte[recordSize]; int read = raf.read(ret); if (read != recordSize) { final String fmt = "read %d bytes, but expected %d"; final String msg = format(fmt, read, recordSize); throw new InvalidArgument(msg); } return ret; } RecordFile(final File path, final RecordMode mode,
            final Column<?>... columns); }
RecordFile implements Iterable<byte[]> { public byte[] read(long record) throws IOException { long pos = record * recordSize + recordSize; if (pos >= size) { final String fmt = "bad seek to position: %d (size is %d)"; final String msg = format(fmt, pos, size); throw new InvalidArgument(msg); } raf.seek(pos); byte[] ret = new byte[recordSize]; int read = raf.read(ret); if (read != recordSize) { final String fmt = "read %d bytes, but expected %d"; final String msg = format(fmt, read, recordSize); throw new InvalidArgument(msg); } return ret; } RecordFile(final File path, final RecordMode mode,
            final Column<?>... columns); byte[] read(long record); void read(long record, byte[] bytes); byte[] read(long record, int column); void read(long record, int column, byte[] bytes); void write(long record, byte[] bytes); void write(long record, int column, byte[] bytes); void append(byte[] bytes); byte[] readMetadata(); void readMetadata(byte[] bytes); @Deprecated void writeMetadata(byte[] bytes); @Override Iterator<byte[]> iterator(); final String getPath(); final Column<?>[] getColumns(); final int getRecordSize(); final boolean isReadOnly(); final boolean isReadWrite(); final long getRecordCount(); final long getSize(); }
RecordFile implements Iterable<byte[]> { public byte[] read(long record) throws IOException { long pos = record * recordSize + recordSize; if (pos >= size) { final String fmt = "bad seek to position: %d (size is %d)"; final String msg = format(fmt, pos, size); throw new InvalidArgument(msg); } raf.seek(pos); byte[] ret = new byte[recordSize]; int read = raf.read(ret); if (read != recordSize) { final String fmt = "read %d bytes, but expected %d"; final String msg = format(fmt, read, recordSize); throw new InvalidArgument(msg); } return ret; } RecordFile(final File path, final RecordMode mode,
            final Column<?>... columns); byte[] read(long record); void read(long record, byte[] bytes); byte[] read(long record, int column); void read(long record, int column, byte[] bytes); void write(long record, byte[] bytes); void write(long record, int column, byte[] bytes); void append(byte[] bytes); byte[] readMetadata(); void readMetadata(byte[] bytes); @Deprecated void writeMetadata(byte[] bytes); @Override Iterator<byte[]> iterator(); final String getPath(); final Column<?>[] getColumns(); final int getRecordSize(); final boolean isReadOnly(); final boolean isReadWrite(); final long getRecordCount(); final long getSize();  }