Package com.jalios.io

Class NIOBufferInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class NIOBufferInputStream
    extends java.io.InputStream
    This class wraps an InputStream around a java.nio.ByteBuffer.
    Since:
    jcms-5.0.0
    Version:
    $Revision: 110358 $
    Author:
    Olivier Dedieu
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.nio.ByteBuffer buffer  
      protected java.nio.channels.Channel channel  
      static java.lang.String REVISION  
    • Constructor Summary

      Constructors 
      Constructor Description
      NIOBufferInputStream​(java.nio.ByteBuffer buffer)
      Construct a NIOBufferInputStream with the given buffer
      NIOBufferInputStream​(java.nio.ByteBuffer buffer, java.nio.channels.Channel channel)
      Construct a NIOBufferInputStream with the given buffer and the given channel.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      void close()  
      void mark​(int readlimit)  
      boolean markSupported()
      mark is *not* supported.
      int read()  
      • Methods inherited from class java.io.InputStream

        nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • buffer

        protected java.nio.ByteBuffer buffer
      • channel

        protected java.nio.channels.Channel channel
    • Constructor Detail

      • NIOBufferInputStream

        public NIOBufferInputStream​(java.nio.ByteBuffer buffer)
        Construct a NIOBufferInputStream with the given buffer
        Parameters:
        buffer - the buffer to be wrapped
        Since:
        jcms-5.0.0
      • NIOBufferInputStream

        public NIOBufferInputStream​(java.nio.ByteBuffer buffer,
                                    java.nio.channels.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 java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException
      • mark

        public void mark​(int readlimit)
        Overrides:
        mark in class java.io.InputStream
      • markSupported

        public boolean markSupported()
        mark is *not* supported.
        Overrides:
        markSupported in class java.io.InputStream