messif.objects.nio
Interface BinaryInput

All Known Implementing Classes:
BufferInputStream, FileChannelInputStream, ChannelInputStream, MappedFileChannelInputStream

public interface BinaryInput

Interface for classes that can read a binary data. Such data can be processed by a BinarySerializator.


Method Summary
 java.nio.ByteBuffer readInput(int minBytes)
          Returns a buffer that contains at least minBytes bytes.
 long skip(long n)
          Skips over and discards n bytes of data from this input.
 

Method Detail

readInput

java.nio.ByteBuffer readInput(int minBytes)
                              throws java.io.IOException
Returns a buffer that contains at least minBytes bytes. If the buffer with the required number of bytes cannot be provided, an IOException is thrown. Note that the returned buffer can provide more than minBytes.

Parameters:
minBytes - the minimal number of bytes that must be available for reading from the buffer
Returns:
the buffer prepared for reading
Throws:
java.io.IOException - if there was an error while preparing a buffer with minBytes bytes

skip

long skip(long n)
          throws java.io.IOException
Skips over and discards n bytes of data from this input. The skip method may, for a variety of reasons, end up skipping over some smaller number of bytes, possibly 0. This may result from any of a number of conditions; reaching end of file before n bytes have been skipped is only one possibility. The actual number of bytes skipped is returned.

Parameters:
n - the number of bytes to be skipped
Returns:
the actual number of bytes skipped
Throws:
java.io.IOException - if the input does not support seek or some other I/O error occurs