Package org.apache.jena.dboe.base.file
Class BufferChannelMem
- java.lang.Object
-
- org.apache.jena.dboe.base.file.BufferChannelMem
-
- All Implemented Interfaces:
org.apache.jena.atlas.lib.Closeable,org.apache.jena.atlas.lib.Sync,BufferChannel
public class BufferChannelMem extends java.lang.Object implements BufferChannel
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static BufferChannelcreate()static BufferChannelcreate(java.lang.String name)BufferChannelduplicate()Return another channel to the same storage but with independent position.java.lang.StringgetFilename()Filename for this BufferChannel (maybe null)java.lang.StringgetLabel()useful display stringbooleanisEmpty()Is it empty?longposition()return the positionvoidposition(long pos)set the positionintread(java.nio.ByteBuffer buffer)Read into a ByteBuffer.intread(java.nio.ByteBuffer buffer, long loc)Read into a ByteBuffer, starting at position loc.longsize()Length of storage, in bytes.voidsync()java.lang.StringtoString()voidtruncate(long size)Truncate the file.intwrite(java.nio.ByteBuffer buffer)Write from ByteBuffer, starting at the current position.intwrite(java.nio.ByteBuffer buffer, long loc)Write from ByteBuffer, starting at position loc.
-
-
-
Method Detail
-
create
public static BufferChannel create()
-
create
public static BufferChannel create(java.lang.String name)
-
duplicate
public BufferChannel 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
-
read
public int read(java.nio.ByteBuffer buffer)
Description copied from interface:BufferChannelRead into a ByteBuffer. Returns the number of bytes read. -1 for end of file.- Specified by:
readin interfaceBufferChannel
-
read
public int read(java.nio.ByteBuffer buffer, long loc)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
public int write(java.nio.ByteBuffer buffer)
Description copied from interface:BufferChannelWrite from ByteBuffer, starting at the current position. Return the number of bytes written- Specified by:
writein interfaceBufferChannel
-
write
public int write(java.nio.ByteBuffer buffer, long loc)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
-
truncate
public void truncate(long size)
Description copied from interface:BufferChannelTruncate the file.- Specified by:
truncatein interfaceBufferChannel- See Also:
FileChannel.truncate(long)
-
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
public java.lang.String getLabel()
Description copied from interface:BufferChanneluseful display string- Specified by:
getLabelin interfaceBufferChannel
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getFilename
public java.lang.String getFilename()
Description copied from interface:BufferChannelFilename for this BufferChannel (maybe null)- Specified by:
getFilenamein interfaceBufferChannel
-
-