Skip navigation links

Oracle Outside In Java API Reference
8.5.4

F11002-01


com.oracle.outsidein
Interface SeekableByteChannel6

All Superinterfaces:
java.nio.channels.ByteChannel, java.nio.channels.Channel, java.io.Closeable, java.nio.channels.ReadableByteChannel, java.nio.channels.WritableByteChannel

public interface SeekableByteChannel6
extends java.nio.channels.ByteChannel

Enables API users to handle I/O for the source and destination documents. Implement this interface to control I/O operations such as reading, writing, and seeking. This interface mimics the java.nio.channels.SeekableByteChannel interface which is only available in Java 7 and later. Note that SeekableByteChannel6 will be removed in favor of java.nio.channels.SeekableByteChannel if support for Java 6 is dropped in a future release of the Outside In Java API. Until then, this interface must be used if redirected I/O is required.


Method Summary
 long position()
          Returns this channel's position.
 SeekableByteChannel6 position(long newPosition)
          Sets this channel's position.
 int read(java.nio.ByteBuffer dst)
          Reads a sequence of bytes from this channel into the given buffer.
 long size()
          Returns the current size of entity to which this channel is connected.
 SeekableByteChannel6 truncate(long size)
          Truncates the entity, to which this channel is connected, to the given size.
 int write(java.nio.ByteBuffer src)
          Writes a sequence of bytes to this channel from the given buffer.

 

Methods inherited from interface java.nio.channels.Channel
close, isOpen

 

Method Detail

read

int read(java.nio.ByteBuffer dst)
         throws java.io.IOException
Reads a sequence of bytes from this channel into the given buffer. Bytes are read starting at this channel's current position, and then the position is updated with the number of bytes actually read.
Specified by:
read in interface java.nio.channels.ReadableByteChannel
Parameters:
dst - The buffer into which bytes are to be transferred
Returns:
The number of bytes read, possibly zero, or -1 if the channel has reached end-of-stream
Throws:
java.io.IOException

write

int write(java.nio.ByteBuffer src)
          throws java.io.IOException
Writes a sequence of bytes to this channel from the given buffer. Bytes are written starting at this channel's current position. The entity to which the channel is connected is grown, if necessary, to accommodate the written bytes, and then the position is updated with the number of bytes actually written.
Specified by:
write in interface java.nio.channels.WritableByteChannel
Parameters:
src - The buffer from which bytes are to be retrieved
Returns:
The number of bytes written, possibly zero
Throws:
java.io.IOException

position

long position()
              throws java.io.IOException
Returns this channel's position.
Returns:
This channel's position, a non-negative integer counting the number of bytes from the beginning of the entity to the current position
Throws:
java.io.IOException

position

SeekableByteChannel6 position(long newPosition)
                              throws java.io.IOException
Sets this channel's position.
Parameters:
newPosition - The new position, a non-negative integer counting the number of bytes from the beginning of the entity
Returns:
This channel
Throws:
java.io.IOException

size

long size()
          throws java.io.IOException
Returns the current size of entity to which this channel is connected.
Returns:
The current size, measured in bytes
Throws:
java.io.IOException

truncate

SeekableByteChannel6 truncate(long size)
                              throws java.io.IOException
Truncates the entity, to which this channel is connected, to the given size. Never invoked by Outside In and may be implemented by just returning this.
Parameters:
size - The new size, a non-negative byte count
Returns:
This channel
Throws:
java.io.IOException

Skip navigation links

Oracle Outside In Java API Reference
8.5.4

F11002-01


Copyright © 2010, 2018, Oracle and/or its affiliates. All rights reserved.