Package org.apache.jena.dboe.base.file
Class BufferChannelFile
java.lang.Object
org.apache.jena.dboe.base.file.BufferChannelFile
- All Implemented Interfaces:
org.apache.jena.atlas.lib.Closeable,org.apache.jena.atlas.lib.Sync,BufferChannel
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static BufferChannelFileCreate a BufferChannelFilestatic BufferChannelFileCreate a BufferChannelFilestatic BufferChannelFilecreateUnmanaged(String filename, String mode) Create a BufferChannelFile with unmanaged file resources - use with careReturn another channel to the same storage but with independent position.Filename for this BufferChannel (maybe null)getLabel()useful display stringbooleanisEmpty()Is it empty?longposition()return the positionvoidposition(long pos) set the positionintread(ByteBuffer buffer) Read into a ByteBuffer.intread(ByteBuffer buffer, long loc) Read into a ByteBuffer, starting at position loc.longsize()Length of storage, in bytes.voidsync()toString()voidtruncate(long length) Truncate the file.intwrite(ByteBuffer buffer) Write from ByteBuffer, starting at the current position.intwrite(ByteBuffer buffer, long loc) Write from ByteBuffer, starting at position loc.
-
Method Details
-
create
Create a BufferChannelFile -
create
Create a BufferChannelFile -
createUnmanaged
Create a BufferChannelFile with unmanaged file resources - use with care -
duplicate
Description copied from interface:BufferChannelReturn another channel to the same storage but with independent position. Chaos may result due to concurrent use.- Specified by:
duplicatein interfaceBufferChannel
-
position
public long position()Description copied from interface:BufferChannelreturn the position- Specified by:
positionin interfaceBufferChannel
-
position
public void position(long pos) Description copied from interface:BufferChannelset the position- Specified by:
positionin interfaceBufferChannel
-
truncate
public void truncate(long length) Description copied from interface:BufferChannelTruncate the file.- Specified by:
truncatein interfaceBufferChannel- See Also:
-
read
Description copied from interface:BufferChannelRead into a ByteBuffer. Returns the number of bytes read. -1 for end of file.- Specified by:
readin interfaceBufferChannel
-
read
Description copied from interface:BufferChannelRead into a ByteBuffer, starting at position loc. Return the number of bytes read. loc must be within the file.- Specified by:
readin interfaceBufferChannel
-
write
Description copied from interface:BufferChannelWrite from ByteBuffer, starting at the current position. Return the number of bytes written- Specified by:
writein interfaceBufferChannel
-
write
Description copied from interface:BufferChannelWrite from ByteBuffer, starting at position loc. Return the number of bytes written. loc must be within 0 to length - writing at length is append- Specified by:
writein interfaceBufferChannel
-
size
public long size()Description copied from interface:BufferChannelLength of storage, in bytes.- Specified by:
sizein interfaceBufferChannel
-
isEmpty
public boolean isEmpty()Description copied from interface:BufferChannelIs it empty?- Specified by:
isEmptyin interfaceBufferChannel
-
sync
public void sync()- Specified by:
syncin interfaceorg.apache.jena.atlas.lib.Sync
-
close
public void close()- Specified by:
closein interfaceorg.apache.jena.atlas.lib.Closeable
-
getLabel
Description copied from interface:BufferChanneluseful display string- Specified by:
getLabelin interfaceBufferChannel
-
toString
-
getFilename
Description copied from interface:BufferChannelFilename for this BufferChannel (maybe null)- Specified by:
getFilenamein interfaceBufferChannel
-