Class PrependableSocket

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

    public class PrependableSocket
    extends java.net.Socket
    • Constructor Summary

      Constructors 
      Constructor Description
      PrependableSocket​(java.net.SocketImpl base)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.InputStream getInputStream()  
      void prependToInputStream​(byte[] bytes, int offset, int length)
      Prepend some bytes that have already been read back to the socket's input stream.
      • Methods inherited from class java.net.Socket

        bind, close, connect, connect, getChannel, getInetAddress, getKeepAlive, getLocalAddress, getLocalPort, getLocalSocketAddress, getOOBInline, getOption, getOutputStream, getPort, getReceiveBufferSize, getRemoteSocketAddress, getReuseAddress, getSendBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTrafficClass, isBound, isClosed, isConnected, isInputShutdown, isOutputShutdown, sendUrgentData, setKeepAlive, setOOBInline, setOption, setPerformancePreferences, setReceiveBufferSize, setReuseAddress, setSendBufferSize, setSocketImplFactory, setSoLinger, setSoTimeout, setTcpNoDelay, setTrafficClass, shutdownInput, shutdownOutput, supportedOptions, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • PrependableSocket

        public PrependableSocket​(java.net.SocketImpl base)
                          throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException
        Overrides:
        getInputStream in class java.net.Socket
        Throws:
        java.io.IOException
      • prependToInputStream

        public void prependToInputStream​(byte[] bytes,
                                         int offset,
                                         int length)
                                  throws java.io.IOException
        Prepend some bytes that have already been read back to the socket's input stream. Note that this method can be called at most once with a non-0 length per socket instance.
        Parameters:
        bytes - the bytes to prepend.
        offset - offset in the byte array to start at.
        length - number of bytes to prepend.
        Throws:
        java.io.IOException - if this method was already called on the socket instance, or if super.getInputStream() throws.