public final class SeekableSMBByteChannel extends Object implements SeekableByteChannel
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the current
SeekableSMBByteChannel. |
boolean |
isOpen()
Determines whether the current
SeekableSMBByteChannel is still opened. |
long |
position()
Returns the position of the pointer into the
SmbRandomAccessFile that is handled by the current instance of SeekableSMBByteChannel |
SeekableByteChannel |
position(long newPosition)
Tries to reposition the pointer into the
SmbRandomAccessFile that is handled by the current instance of SeekableSMBByteChannel |
int |
read(ByteBuffer dst)
Reads the content from the
SmbRandomAccessFile handled by the current instance of SeekableSMBByteChannel to
the provided ByteBuffer. |
long |
size()
Returns the size of the file handled by the current instance of
SeekableSMBByteChannel. |
SeekableByteChannel |
truncate(long size)
Truncates the
SmbRandomAccessFile by setting its length to the provided value. |
int |
write(ByteBuffer src)
Writes the content of the provided
ByteBuffer into the SmbRandomAccessFile handled by the current
instance of SeekableSMBByteChannel. |
public int read(ByteBuffer dst) throws IOException
SmbRandomAccessFile handled by the current instance of SeekableSMBByteChannel to
the provided ByteBuffer. The ByteBuffer is written from its current position to its end.read in interface ReadableByteChannelread in interface SeekableByteChanneldst - ByteBuffer to which to write the data.IOException - If something goes wrong while reading to the file.public int write(ByteBuffer src) throws IOException
ByteBuffer into the SmbRandomAccessFile handled by the current
instance of SeekableSMBByteChannel. The ByteBuffer is read from its current position to it end.write in interface SeekableByteChannelwrite in interface WritableByteChannelsrc - ByteBuffer from which to read the data.IOException - If something goes wrong while writing to the file.public long position()
throws IOException
SmbRandomAccessFile that is handled by the current instance of SeekableSMBByteChannelposition in interface SeekableByteChannelIOException - If something goes wrong while trying to determine file size.public long size()
throws IOException
SeekableSMBByteChannel. The size
is given in number of bytes.size in interface SeekableByteChannelIOException - If something goes wrong while trying to determine file size.public SeekableByteChannel position(long newPosition) throws IOException
SmbRandomAccessFile that is handled by the current instance of SeekableSMBByteChannelposition in interface SeekableByteChannelnewPosition - New position within the file.SeekableSMBByteChannel.IOException - If something goes wrong while trying to determine file size.public SeekableByteChannel truncate(long size) throws IOException
SmbRandomAccessFile by setting its length to the provided value.truncate in interface SeekableByteChannelsize - New size of the file.SeekableSMBByteChannel.IOException - If something goes wrong during truncation.public boolean isOpen()
SeekableSMBByteChannel is still opened.isOpen in interface ChannelSeekableSMBByteChannel and false otherwise.public void close()
throws IOException
SeekableSMBByteChannel. After that, is is not possible to either read from or
write to the channel.close in interface Closeableclose in interface AutoCloseableclose in interface ChannelIOException - If something goes wrong while closing the channel.Copyright © 2017 pontius software GmbH. All rights reserved.