| java.lang.Object com.mobixess.jodb.core.io.buffers.RandomAccessFileTransactionBuffer
Method Summary | |
public void | close() | public void | delete() | public ByteChannel | getChannel() | public long | getCursorOffset() | public long | length() | public void | prefetch(long offset) | public void | read(byte[] b, int off, int len) | public boolean | readBoolean() | public byte | readByte() | public char | readChar() | public double | readDouble() | public float | readFloat() | public void | readFully(byte[] b) | public void | readFully(byte[] b, int off, int len) | public int | readInt() | public String | readLine() | public long | readLong() | public short | readShort() | public String | readUTF() | public int | readUnsignedByte() | public int | readUnsignedShort() | public void | resetToEnd() | public void | resetToStart() | public void | seek(long pos) | public void | setLength(long newLength) | public long | skip(long n) | public int | skipBytes(int n) | public String | toString() | public long | transferFrom(ReadableByteChannel src, long position, long count) Transfers bytes into this channel's file from the given readable byte
channel.
An attempt is made to read up to count bytes from the
source channel and write them to this channel's file starting at the
given position. | public long | transferTo(long position, long count, WritableByteChannel target) Transfers bytes from this channel's file to the given writable byte
channel.
An attempt is made to read up to count bytes starting at
the given position in this channel's file and write them to the
target channel. | public void | write(int b) | public void | write(byte[] b) | public void | write(byte[] b, int off, int len) | public void | writeBoolean(boolean v) | public void | writeByte(int v) | public void | writeBytes(String s) | public void | writeChar(int v) | public void | writeChars(String s) | public void | writeDouble(double v) | public void | writeFloat(float v) | public void | writeInt(int v) | public void | writeLong(long v) | public void | writeShort(int v) | public void | writeUTF(String str) |
RandomAccessFileTransactionBuffer | RandomAccessFileTransactionBuffer(File file, boolean write) throws IOException(Code) | | |
close | public void close() throws IOException(Code) | | Parameters: file - Parameters: raFile - |
transferFrom | public long transferFrom(ReadableByteChannel src, long position, long count) throws IOException(Code) | | Transfers bytes into this channel's file from the given readable byte
channel.
An attempt is made to read up to count bytes from the
source channel and write them to this channel's file starting at the
given position. An invocation of this method may or may not
transfer all of the requested bytes; whether or not it does so depends
upon the natures and states of the channels. Fewer than the requested
number of bytes will be transferred if the source channel has fewer than
count bytes remaining, or if the source channel is non-blocking
and has fewer than count bytes immediately available in its
input buffer.
This method does not modify this channel's position. If the given
position is greater than the file's current size then no bytes are
transferred. If the source channel has a position then bytes are read
starting at that position and then the position is incremented by the
number of bytes read.
This method is potentially much more efficient than a simple loop
that reads from the source channel and writes to this channel. Many
operating systems can transfer bytes directly from the source channel
into the filesystem cache without actually copying them.
Parameters: src - The source channel Parameters: position - The position within the file at which the transfer is to begin;must be non-negative Parameters: count - The maximum number of bytes to be transferred; must benon-negative The number of bytes, possibly zero,that were actually transferred throws: IllegalArgumentException - If the preconditions on the parameters do not hold throws: NonReadableChannelException - If the source channel was not opened for reading throws: NonWritableChannelException - If this channel was not opened for writing throws: ClosedChannelException - If either this channel or the source channel is closed throws: AsynchronousCloseException - If another thread closes either channelwhile the transfer is in progress throws: ClosedByInterruptException - If another thread interrupts the current thread while thetransfer is in progress, thereby closing both channels andsetting the current thread's interrupt status throws: IOException - If some other I/O error occurs |
transferTo | public long transferTo(long position, long count, WritableByteChannel target) throws IOException(Code) | | Transfers bytes from this channel's file to the given writable byte
channel.
An attempt is made to read up to count bytes starting at
the given position in this channel's file and write them to the
target channel. An invocation of this method may or may not transfer
all of the requested bytes; whether or not it does so depends upon the
natures and states of the channels. Fewer than the requested number of
bytes are transferred if this channel's file contains fewer than
count bytes starting at the given position, or if the
target channel is non-blocking and it has fewer than count
bytes free in its output buffer.
This method does not modify this channel's position. If the given
position is greater than the file's current size then no bytes are
transferred. If the target channel has a position then bytes are
written starting at that position and then the position is incremented
by the number of bytes written.
This method is potentially much more efficient than a simple loop
that reads from this channel and writes to the target channel. Many
operating systems can transfer bytes directly from the filesystem cache
to the target channel without actually copying them.
Parameters: position - The position within the file at which the transfer is to begin;must be non-negative Parameters: count - The maximum number of bytes to be transferred; must benon-negative Parameters: target - The target channel The number of bytes, possibly zero,that were actually transferred throws: IllegalArgumentException - If the preconditions on the parameters do not hold throws: NonReadableChannelException - If this channel was not opened for reading throws: NonWritableChannelException - If the target channel was not opened for writing throws: ClosedChannelException - If either this channel or the target channel is closed throws: AsynchronousCloseException - If another thread closes either channelwhile the transfer is in progress throws: ClosedByInterruptException - If another thread interrupts the current thread while thetransfer is in progress, thereby closing both channels andsetting the current thread's interrupt status throws: IOException - If some other I/O error occurs |
|
|