Class SocketChannelReader


  • public class SocketChannelReader
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private ORB orb  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.nio.ByteBuffer allocateBuffer()  
      private java.nio.ByteBuffer expandBuffer​(java.nio.ByteBuffer byteBuffer)  
      private boolean haveFilledBuffer​(java.nio.ByteBuffer byteBuffer)  
      private java.nio.ByteBuffer prepareToAppendTo​(java.nio.ByteBuffer byteBuffer)  
      java.nio.ByteBuffer read​(java.nio.channels.SocketChannel channel, java.nio.ByteBuffer previouslyReadData, int minNeeded)
      Reads all currently available data from the socket channel, appending it to any data left from a previous read.
      private java.nio.ByteBuffer reallocateBuffer​(java.nio.ByteBuffer byteBuffer)  
      • Methods inherited from class java.lang.Object

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

      • orb

        private ORB orb
    • Constructor Detail

      • SocketChannelReader

        public SocketChannelReader​(ORB orb)
    • Method Detail

      • read

        public java.nio.ByteBuffer read​(java.nio.channels.SocketChannel channel,
                                        java.nio.ByteBuffer previouslyReadData,
                                        int minNeeded)
                                 throws java.io.IOException
        Reads all currently available data from the socket channel, appending it to any data left from a previous read.
        Parameters:
        channel - the channel from which to read
        previouslyReadData - the old data to read; note: all data up to the limit is considered valid.
        minNeeded - the minimum number of bytes that should be present in the buffer before returning
        Returns:
        a buffer containing all old data, with all newly available data appended to it.
        Throws:
        java.io.IOException - if an error occurs while reading from the channel.
      • expandBuffer

        private java.nio.ByteBuffer expandBuffer​(java.nio.ByteBuffer byteBuffer)
      • haveFilledBuffer

        private boolean haveFilledBuffer​(java.nio.ByteBuffer byteBuffer)
      • prepareToAppendTo

        private java.nio.ByteBuffer prepareToAppendTo​(java.nio.ByteBuffer byteBuffer)
      • reallocateBuffer

        private java.nio.ByteBuffer reallocateBuffer​(java.nio.ByteBuffer byteBuffer)
      • allocateBuffer

        private java.nio.ByteBuffer allocateBuffer()