@Override public void writeAll( ByteBuffer src ) throws IOException { delegate.writeAll( src ); }
public static void writeLogHeader( StoreChannel channel, long logVersion, long previousLastCommittedTxId ) throws IOException { ByteBuffer buffer = ByteBuffer.allocate( LOG_HEADER_SIZE ); writeLogHeader( buffer, logVersion, previousLastCommittedTxId ); channel.writeAll( buffer ); }
private void write( StoreChannel channel, long time, long identifier, long version, long lastCommittedTxId, long indexVersion ) throws IOException { buf.clear(); buf.putLong( time ).putLong( identifier ).putLong( version ).putLong( lastCommittedTxId ).putLong( indexVersion ); buf.flip(); channel.writeAll( buf, 0 ); channel.force( true ); }
@Override public void writeAll( ByteBuffer src, long position ) throws IOException { fs.ensureHasSpace(); inner.writeAll( src, position ); }
@Override public void writeAll( ByteBuffer src, long position ) throws IOException { delegate.writeAll( src, offset( position ) ); }
@Override public void writeAll( ByteBuffer src ) throws IOException { fs.ensureHasSpace(); inner.writeAll( src ); }
private void markAsCleanlyClosed( ) throws IOException { // remove sticky ByteBuffer buffer = ByteBuffer.allocate( Byte.BYTES ); buffer.put( CLEAN_GENERATOR ).flip(); fileChannel.position( 0 ); fileChannel.writeAll( buffer ); }
@Override public void writeAll( ByteBuffer src ) throws IOException { advance( src.remaining() ); delegateChannel.writeAll( src ); }
private void markAsSticky() throws IOException { ByteBuffer buffer = ByteBuffer.allocate( Byte.BYTES ); buffer.put( STICKY_GENERATOR ).flip(); fileChannel.position( 0 ); fileChannel.writeAll( buffer ); fileChannel.force( false ); }
@Override public void writeAll( ByteBuffer src ) throws IOException { adversary.injectFailure( IOException.class ); delegate.writeAll( src ); }
private void storeFileContent( File file, ByteBuffer sourceBuffer ) throws IOException { try ( StoreChannel storeChannel = fileSystem.create( file ) ) { storeChannel.writeAll( sourceBuffer ); } } }
private void createFileOfSize( File file, int size ) throws IOException { try ( StoreChannel storeChannel = fs.create( file ) ) { byte[] bytes = new byte[size]; ByteBuffer buffer = ByteBuffer.wrap( bytes ); storeChannel.writeAll( buffer ); } }
@Override public void writeAll( ByteBuffer src, long position ) throws IOException { adversary.injectFailure( IOException.class ); delegate.writeAll( src, position ); }
private void writeInitialDataTo( File file ) throws IOException { try ( StoreChannel channel = fs.create( file ) ) { ByteBuffer buf = ByteBuffer.allocate( 16 ); buf.putLong( x ); buf.putLong( y ); buf.flip(); channel.writeAll( buf ); } }
private void writeIntegerIntoFile( File targetFile ) throws IOException { StoreChannel storeChannel = fsa.create( targetFile ); ByteBuffer byteBuffer = ByteBuffer.allocate( Integer.SIZE ).putInt( 7 ); byteBuffer.flip(); storeChannel.writeAll( byteBuffer ); storeChannel.close(); } }
private void createRandomFile( File rootFolder ) throws IOException { File file = new File( rootFolder, RandomStringUtils.randomNumeric( 5 ) ); try ( StoreChannel channel = fs.create( file ) ) { channel.writeAll( ByteBuffer.allocate( 100 ) ); } }
@Test( expected = ClosedByInterruptException.class ) public void ch_writeAll_ByteBuffer() throws IOException { chan( true ).writeAll( ByteBuffer.allocate( 1 ) ); }
@Test void writeAll() throws Exception { channel.writeAll( buf ); verify( actual ).writeAll( buf ); }
@Test( expected = ClosedByInterruptException.class ) public void ch_writeAll_ByteBuffer_position() throws IOException { chan( true ).writeAll( ByteBuffer.allocate( 1 ), 1 ); }
@Test void writeAllWithPosition() throws Exception { long position = 500; channel.writeAll( buf, position ); verify( actual ).writeAll( buf, position + offset ); }