Package com.martiansoftware.nailgun
Class NGInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- com.martiansoftware.nailgun.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.
-
-
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.
-
-
-
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 wrapout
- 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 classjava.io.FilterInputStream
- Throws:
java.io.IOException
- See Also:
InputStream.available()
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classjava.io.FilterInputStream
- See Also:
InputStream.markSupported()
-
read
public int read() throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
- See Also:
InputStream.read()
-
read
public int read(byte[] b) throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int offset, int length) throws java.io.IOException
- Overrides:
read
in classjava.io.FilterInputStream
- Throws:
java.io.IOException
-
-