Class NamedPipe

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

    public class NamedPipe
    extends Open<PipeShare>
    • Nested Class Summary

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.slf4j.Logger logger  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getName()  
      byte[] ioctl​(long ctlCode, boolean isFsCtl, byte[] inData, int inOffset, int inLength)
      Sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.
      int ioctl​(long ctlCode, boolean isFsCtl, byte[] inData, int inOffset, int inLength, byte[] outData, int outOffset, int outLength)
      Sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.
      FsCtlPipePeekResponse peek()
      Requests that the server read data from this pipe without removing it.
      FsCtlPipePeekResponse peek​(int maxDataSize)
      Requests that the server read data from this pipe without removing it.
      int read​(byte[] buffer)
      Read data from this pipe starting into the given buffer.
      int read​(byte[] buffer, int offset, int length)
      Read data from this pipe into the given buffer.
      byte[] transact​(byte[] inBuffer)
      Performs a transaction on this pipe.
      int transact​(byte[] inBuffer, byte[] outBuffer)
      Performs a transaction on this pipe.
      int transact​(byte[] inBuffer, int inOffset, int inLength, byte[] outBuffer, int outOffset, int outLength)
      Performs a transaction on this pipe.
      int write​(byte[] buffer)
      Write the data in buffer to this pipe.
      int write​(byte[] buffer, int offset, int length)
      Write the data in buffer to this pipe.
      • Methods inherited from class java.lang.Object

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

      • logger

        protected final org.slf4j.Logger logger
    • Method Detail

      • getName

        public java.lang.String getName()
      • write

        public int write​(byte[] buffer)
        Write the data in buffer to this pipe.
        Parameters:
        buffer - the data to write
        Returns:
        the actual number of bytes that was written to the file
      • write

        public int write​(byte[] buffer,
                         int offset,
                         int length)
        Write the data in buffer to this pipe.
        Parameters:
        buffer - the data to write
        offset - the start offset in the data
        length - the number of bytes that are written
        Returns:
        the actual number of bytes that was written to the file
      • read

        public int read​(byte[] buffer)
        Read data from this pipe starting into the given buffer.
        Parameters:
        buffer - the buffer to write into
        Returns:
        the actual number of bytes that were read
      • read

        public int read​(byte[] buffer,
                        int offset,
                        int length)
        Read data from this pipe into the given buffer.
        Parameters:
        buffer - the buffer to write into
        offset - the start offset in the buffer at which to write data
        length - the maximum number of bytes to read
        Returns:
        the actual number of bytes that were read
      • transact

        public byte[] transact​(byte[] inBuffer)
        Performs a transaction on this pipe. This combines the writing a message to and reading a message from this pipe into a single network operation.
        Parameters:
        inBuffer - the input message
        Returns:
        the output message
      • transact

        public int transact​(byte[] inBuffer,
                            byte[] outBuffer)
        Performs a transaction on this pipe. This combines the writing a message to and reading a message from this pipe into a single network operation.

        This method is equivalent to calling transact(inBuffer, 0, inBuffer.length, outBuffer, 0, outBuffer.length.

        Parameters:
        inBuffer - the input message
        outBuffer - the buffer in which to write the output message
        Returns:
        the number of bytes written to outBuffer
      • transact

        public int transact​(byte[] inBuffer,
                            int inOffset,
                            int inLength,
                            byte[] outBuffer,
                            int outOffset,
                            int outLength)
        Performs a transaction on this pipe. This combines the writing a message to and reading a message from this pipe into a single network operation.
        Parameters:
        inBuffer - the input message
        inOffset - the offset in inBuffer at which the input message start
        inLength - the length of the input message in inBuffer starting at inOffset
        outBuffer - the buffer in which to write the output message
        outOffset - the offset in outBuffer at which the output message should be written
        outLength - the maximum number of bytes that may be written to outBuffer starting from outOffset
        Returns:
        the number of bytes written to outBuffer
      • peek

        public FsCtlPipePeekResponse peek()
        Requests that the server read data from this pipe without removing it. This method is equivalent to calling peek(0).
        Returns:
        the peek response
      • peek

        public FsCtlPipePeekResponse peek​(int maxDataSize)
        Requests that the server read data from this pipe without removing it.
        Parameters:
        maxDataSize - the maximum amount of data to peek
        Returns:
        the peek response
      • ioctl

        public byte[] ioctl​(long ctlCode,
                            boolean isFsCtl,
                            byte[] inData,
                            int inOffset,
                            int inLength)
        Sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.
        Parameters:
        ctlCode - the control code
        isFsCtl - true if the control code is an FSCTL; false if it is an IOCTL
        inData - the control code dependent input data
        inOffset - the offset in inData where the input data starts
        inLength - the number of bytes from inData to send, starting at offset
        Returns:
        the response data or null if the control code did not produce a response
      • ioctl

        public int ioctl​(long ctlCode,
                         boolean isFsCtl,
                         byte[] inData,
                         int inOffset,
                         int inLength,
                         byte[] outData,
                         int outOffset,
                         int outLength)
        Sends a control code directly to a specified device driver, causing the corresponding device to perform the corresponding operation.
        Parameters:
        ctlCode - the control code
        isFsCtl - true if the control code is an FSCTL; false if it is an IOCTL
        inData - the control code dependent input data
        inOffset - the offset in inData where the input data starts
        inLength - the number of bytes from inData to send, starting at inOffset
        outData - the buffer where the response data should be written
        outOffset - the offset in outData where the output data should be written
        outLength - the maximum amount of data to write in outData, starting at outOffset
        Returns:
        the number of bytes written to outData