com.jalios.io
Class NIOBufferInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by com.jalios.io.NIOBufferInputStream
All Implemented Interfaces:
Closeable

public class NIOBufferInputStream
extends InputStream

This class wraps an InputStream around a java.nio.ByteBuffer.

Since:
jcms-5.0.0
Version:
$Revision: 27751 $
Author:
Olivier Dedieu

Field Summary
protected  ByteBuffer buffer
           
protected  Channel channel
           
static String REVISION
           
 
Constructor Summary
NIOBufferInputStream(ByteBuffer buffer)
          Construct a NIOBufferInputStream with the given buffer
NIOBufferInputStream(ByteBuffer buffer, Channel channel)
          Construct a NIOBufferInputStream with the given buffer and the given channel.
 
Method Summary
 int available()
           
 void close()
           
 void mark(int readlimit)
           
 boolean markSupported()
          mark is *not* supported.
 int read()
           
 
Methods inherited from class java.io.InputStream
read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

buffer

protected ByteBuffer buffer

channel

protected Channel channel
Constructor Detail

NIOBufferInputStream

public NIOBufferInputStream(ByteBuffer buffer)
Construct a NIOBufferInputStream with the given buffer

Parameters:
buffer - the buffer to be wrapped
Since:
jcms-5.0.0

NIOBufferInputStream

public NIOBufferInputStream(ByteBuffer buffer,
                            Channel channel)
Construct a NIOBufferInputStream with the given buffer and the given channel. The channel is closed when the InputStream is closed.

Parameters:
buffer - the buffer to be wrapped
channel - the channel the buffer is associated to.
Since:
jcms-5.0.0
Method Detail

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
IOException

available

public int available()
              throws IOException
Overrides:
available in class InputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

mark

public void mark(int readlimit)
Overrides:
mark in class InputStream

markSupported

public boolean markSupported()
mark is *not* supported.

Overrides:
markSupported in class InputStream


Copyright © 2001-2010 Jalios SA. All Rights Reserved.