public void setCurrentPosition( LogPosition position ) throws IOException, UnsupportedOperationException { channel.position( position.getByteOffset() ); } }
@Override public LogPositionMarker getCurrentPosition( LogPositionMarker positionMarker ) throws IOException { positionMarker.mark( logVersionedStoreChannel.getVersion(), channel.position() ); return positionMarker; }
@Test public void arraysShouldCalculateCorrectLength() throws IOException { // given int[] value = new int[3]; for ( int i = 0; i < value.length; i++ ) { value[i] = 100 + i; } ValueType valueType = ValueType.typeOf( value ); PhysicalFlushableChannel channel = new PhysicalFlushableChannel( fs.open( directory.file( "file" ), OpenMode.READ_WRITE ) ); // when int length = valueType.length( value ); valueType.write( value, channel ); // then int expected = 1 + // component type Integer.BYTES + // array length value.length * Integer.BYTES; // array data assertEquals( expected, length ); assertEquals( expected, channel.position() ); } }
public void setCurrentPosition( LogPosition position ) throws IOException, UnsupportedOperationException { channel.position( position.getByteOffset() ); } }
synchronized long position() throws IOException { return getOrCreateWriter().position(); }
synchronized long position() throws IOException { return getOrCreateWriter().position(); }
@Override public LogPositionMarker getCurrentPosition( LogPositionMarker positionMarker ) throws IOException { positionMarker.mark( logVersionedStoreChannel.getVersion(), channel.position() ); return positionMarker; }