Class NGInputStream

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

    class NGInputStream
    extends java.io.FilterInputStream
    A FilterInputStream that is able to read the chunked stdin stream from a NailGun client.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.DataInputStream din  
      private boolean eof  
      private byte[] oneByteBuffer  
      private java.io.DataOutputStream out  
      private long remaining  
      private boolean started  
      • Fields inherited from class java.io.FilterInputStream

        in
    • Constructor Summary

      Constructors 
      Constructor Description
      NGInputStream​(java.io.InputStream in, java.io.DataOutputStream out)
      Creates a new NGInputStream wrapping the specified InputStream
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      boolean markSupported()  
      int read()  
      int read​(byte[] b)  
      int read​(byte[] b, int offset, int length)  
      private void readHeader()
      Reads a NailGun chunk header from the underlying InputStream.
      • Methods inherited from class java.io.FilterInputStream

        close, mark, reset, skip
      • Methods inherited from class java.io.InputStream

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

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

      • din

        private java.io.DataInputStream din
      • eof

        private boolean eof
      • remaining

        private long remaining
      • oneByteBuffer

        private byte[] oneByteBuffer
      • out

        private final java.io.DataOutputStream out
      • started

        private boolean started
    • Constructor Detail

      • NGInputStream

        public NGInputStream​(java.io.InputStream in,
                             java.io.DataOutputStream out)
        Creates a new NGInputStream wrapping the specified InputStream
        Parameters:
        in - the InputStream to wrap
        out - the OutputStream to which a STARTINPUT chunk should be sent prior to the first read.
    • Method Detail

      • readHeader

        private void readHeader()
                         throws java.io.IOException
        Reads a NailGun chunk header from the underlying InputStream.
        Throws:
        java.io.IOException - if thrown by the underlying InputStream, or if an unexpected NailGun chunk type is encountered.
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.FilterInputStream
        Throws:
        java.io.IOException
        See Also:
        InputStream.available()
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.FilterInputStream
        See Also:
        InputStream.markSupported()
      • read

        public int read()
                 throws java.io.IOException
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException
        See Also:
        InputStream.read()
      • read

        public int read​(byte[] b)
                 throws java.io.IOException
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b,
                        int offset,
                        int length)
                 throws java.io.IOException
        Overrides:
        read in class java.io.FilterInputStream
        Throws:
        java.io.IOException