@Test public void testIterationDoesntChangePosition() throws IOException { long position = fileRecords.channel().position(); Iterator<Record> records = fileRecords.records().iterator(); for (byte[] value : values) { assertTrue(records.hasNext()); assertEquals(records.next().value(), ByteBuffer.wrap(value)); } assertEquals(position, fileRecords.channel().position()); }
public FileChannel channel() { return channel; }
FileRecords extends AbstractRecords implements Closeable { public FileChannel channel() { return channel; } }
FileRecords extends AbstractRecords implements Closeable { public FileChannel channel() { return channel; } FileRecords(File file,
                       FileChannel channel,
                       int start,
                       int end,
                       boolean isSlice); }
FileRecords extends AbstractRecords implements Closeable { public FileChannel channel() { return channel; } FileRecords(File file,
                       FileChannel channel,
                       int start,
                       int end,
                       boolean isSlice); @Override int sizeInBytes(); File file(); FileChannel channel(); ByteBuffer readInto(ByteBuffer buffer, int position); FileRecords read(int position, int size); int append(MemoryRecords records); void flush(); void close(); boolean delete(); void trim(); void setFile(File file); void renameTo(File f); int truncateTo(int targetSize); @Override Records downConvert(byte toMagic, long firstOffset); @Override long writeTo(GatheringByteChannel destChannel, long offset, int length); LogOffsetPosition searchForOffsetWithSize(long targetOffset, int startingPosition); TimestampAndOffset searchForTimestamp(long targetTimestamp, int startingPosition, long startingOffset); TimestampAndOffset largestTimestampAfter(int startingPosition); @Override Iterable<FileChannelRecordBatch> batches(); static FileRecords open(File file,
                                   boolean mutable,
                                   boolean fileAlreadyExists,
                                   int initFileSize,
                                   boolean preallocate); static FileRecords open(File file,
                                   boolean fileAlreadyExists,
                                   int initFileSize,
                                   boolean preallocate); static FileRecords open(File file, boolean mutable); static FileRecords open(File file); }
FileRecords extends AbstractRecords implements Closeable { public FileChannel channel() { return channel; } FileRecords(File file,
                       FileChannel channel,
                       int start,
                       int end,
                       boolean isSlice); @Override int sizeInBytes(); File file(); FileChannel channel(); ByteBuffer readInto(ByteBuffer buffer, int position); FileRecords read(int position, int size); int append(MemoryRecords records); void flush(); void close(); boolean delete(); void trim(); void setFile(File file); void renameTo(File f); int truncateTo(int targetSize); @Override Records downConvert(byte toMagic, long firstOffset); @Override long writeTo(GatheringByteChannel destChannel, long offset, int length); LogOffsetPosition searchForOffsetWithSize(long targetOffset, int startingPosition); TimestampAndOffset searchForTimestamp(long targetTimestamp, int startingPosition, long startingOffset); TimestampAndOffset largestTimestampAfter(int startingPosition); @Override Iterable<FileChannelRecordBatch> batches(); static FileRecords open(File file,
                                   boolean mutable,
                                   boolean fileAlreadyExists,
                                   int initFileSize,
                                   boolean preallocate); static FileRecords open(File file,
                                   boolean fileAlreadyExists,
                                   int initFileSize,
                                   boolean preallocate); static FileRecords open(File file, boolean mutable); static FileRecords open(File file);  }