|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface for a channel that supports random access to its data. In other words, the channel has a position and its position may be modified.
Method Summary | |
long |
position()
Returns the channel's position. |
RandomAccessChannel |
position(long newPosition)
Sets this channel's position. |
long |
size()
Returns the size of this channel. |
Methods inherited from interface java.nio.channels.Channel |
close, isOpen |
Method Detail |
public long position() throws ClosedChannelException, IOException
ClosedChannelException
- if the channel was
closed.
IOException
- if an I/O error occurs.public RandomAccessChannel position(long newPosition) throws IOException, ClosedChannelException, IllegalArgumentException
Setting the position to a value that is greater than the channel's current size is legal but does not change its size. A later attempt to read bytes at such a position will immediately return an end-of-file indication. A later attempt to write bytes at such a position will cause the channel to be grown to accomodate the new bytes; the values of any bytes between the previous end-of-file and the newly-written bytes are unspecified.
newPosition
- The new position, a non-negative
integer counting the number of
bytes from the beginning of the
channel.
IllegalArgumentException
- If the new position is negative.
ClosedChannelException
- if the channel was
closed.
IOException
- if an I/O error occurs.public long size() throws IOException, ClosedChannelException
ClosedChannelException
- if the channel was
closed.
IOException
- if an I/O error occurs.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |