org.apache.avro.util
Class ByteBufferInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.apache.avro.util.ByteBufferInputStream
All Implemented Interfaces:
Closeable

public class ByteBufferInputStream
extends InputStream

Utility to present ByteBuffer data as an InputStream.


Constructor Summary
ByteBufferInputStream(List<ByteBuffer> buffers)
           
 
Method Summary
 int read()
           
 int read(byte[] b, int off, int len)
           
 ByteBuffer readBuffer(int length)
          Read a buffer from the input without copying, if possible.
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteBufferInputStream

public ByteBufferInputStream(List<ByteBuffer> buffers)
Method Detail

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
EOFException - if EOF is reached.
IOException
See Also:
InputStream.read()

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class InputStream
Throws:
EOFException - if EOF is reached before reading all the bytes.
IOException
See Also:
InputStream.read(byte[], int, int)

readBuffer

public ByteBuffer readBuffer(int length)
                      throws IOException
Read a buffer from the input without copying, if possible.

Throws:
EOFException - if EOF is reached before reading all the bytes.
IOException


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.