private SeekableByteChannelFileBasedImpl createANewByteChannel(final File file) throws FileNotFoundException { return new SeekableByteChannelFileBasedImpl(new RandomAccessFile(file, "rw").getChannel()) { @Override public void close() throws java.io.IOException { super.close(); } }; }
@Override public void close() throws java.io.IOException { super.close(); } };
private SeekableByteChannelFileBasedImpl createANewByteChannel(final File file) throws FileNotFoundException { return new SeekableByteChannelFileBasedImpl(new RandomAccessFile(file, "rw").getChannel()) { @Override public void close() throws java.io.IOException { super.close(); } }; }
@Override public void close() throws java.io.IOException { super.close(); } };
private SeekableByteChannelFileBasedImpl openAByteChannel(Path path) throws FileNotFoundException { return new SeekableByteChannelFileBasedImpl(new RandomAccessFile(path.toFile(), "r").getChannel()); }
private SeekableByteChannelFileBasedImpl openAByteChannel(Path path) throws FileNotFoundException { return new SeekableByteChannelFileBasedImpl(new RandomAccessFile(path.toFile(), "r").getChannel()); }
private SeekableByteChannelFileBasedImpl openAByteChannel(Path path) throws FileNotFoundException { return new SeekableByteChannelFileBasedImpl(new RandomAccessFile(path.toFile(), "r").getChannel()); }
"woot"); return new SeekableByteChannelFileBasedImpl(new RandomAccessFile(file, "rw").getChannel()) { @Override
@Test public void test() throws IOException { final File tempFile = File.createTempFile("foo", "bar"); final SeekableByteChannel sbc = new SeekableByteChannelFileBasedImpl(new RandomAccessFile(tempFile, "rw").getChannel()); assertTrue(sbc.isOpen()); sbc.write(ByteBuffer.wrap("CONTENT\n?!".getBytes())); sbc.position(0L); ByteBuffer buffer = ByteBuffer.allocate(10); sbc.read(buffer); assertEquals("CONTENT\n?!", new String(buffer.array())); sbc.close(); assertFalse(sbc.isOpen()); }
"bar"); final SeekableByteChannel sbc = new SeekableByteChannelFileBasedImpl(new RandomAccessFile(tempFile, "rw").getChannel());