public class ChunkInputStream extends InputStream
| Modifier and Type | Field and Description |
|---|---|
protected int |
avail |
protected int |
chunksize |
protected int |
flags |
protected InputStream |
input |
protected ByteOrder |
localorder |
protected ByteOrder |
remoteorder |
protected RequestMode |
requestmode |
protected dap4.dap4shared.ChunkInputStream.State |
state |
| Constructor and Description |
|---|
ChunkInputStream(InputStream input,
RequestMode requestmode) |
ChunkInputStream(InputStream input,
RequestMode requestmode,
ByteOrder order) |
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Returns an estimate of the number of databuffer that can be read
(or skipped over) from this input stream without
blocking by the next invocation of a method for this
input stream.
|
void |
close()
Closes this output stream and releases any system resources
associated with this stream.
|
ByteOrder |
getByteOrder() |
int |
read()
Reads the next byte of databuffer from the input stream.
|
int |
read(byte[] buf,
int off,
int len)
Reads up to len databuffer of databuffer from the input stream into an
array of databuffer.
|
String |
readDMR()
Read the DMR, trimmed.
|
String |
readError()
Read an error chunk
|
void |
throwError(String document)
Convert an error chunk to an exception
|
mark, markSupported, read, reset, skipprotected InputStream input
protected dap4.dap4shared.ChunkInputStream.State state
protected RequestMode requestmode
protected ByteOrder localorder
protected ByteOrder remoteorder
protected int flags
protected int chunksize
protected int avail
public ChunkInputStream(InputStream input, RequestMode requestmode)
public ChunkInputStream(InputStream input, RequestMode requestmode, ByteOrder order)
public ByteOrder getByteOrder()
public String readDMR() throws DapException
DapExceptionpublic void throwError(String document) throws ErrorException
document - XML representation of the errorDapException - containing the contents of the error chunkErrorExceptionpublic String readError() throws IOException
IOExceptionpublic int read()
throws IOException
int in the range 0 to
255. If no byte is available because the end of the stream
has been reached, the value -1 is returned. This method
blocks until input databuffer is available, the end of the stream is detected,
or an exception is thrown.
Operates by loading chunk by chunk. If an error chunk is detected,
then return ErrorException (which is a subclass of IOException).read in class InputStream-1 if the end of the
stream is reached.IOException - if an I/O error occurs.public int read(byte[] buf,
int off,
int len)
throws IOException
read in class InputStreambuf - the byte array into which databuffer is readoff - the offset in the byte array at which to writelen - the amount to readIOExceptionpublic int available()
available in class InputStreampublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionCopyright © 1999-2015 UCAR/Unidata. All Rights Reserved.