public class ChunkWriter extends OutputStream
Modifier and Type | Class and Description |
---|---|
protected static class |
ChunkWriter.State |
Modifier and Type | Field and Description |
---|---|
protected ByteBuffer |
chunk |
static byte[] |
CRLF8 |
protected static boolean |
DEBUG |
protected byte[] |
dmr8 |
protected ByteBuffer |
header |
protected int |
maxbuffersize |
protected RequestMode |
mode |
protected ByteOrder |
order |
protected OutputStream |
output |
protected ChunkWriter.State |
state |
protected long |
writecount |
protected long |
writelimit |
Constructor and Description |
---|
ChunkWriter(OutputStream output,
RequestMode mode,
ByteOrder order) |
Modifier and Type | Method and Description |
---|---|
static void |
chunkheader(int length,
int flags,
ByteBuffer hdrbuf) |
void |
close()
Closes this output stream and releases any system resources
associated with this stream.
|
void |
flush()
Flushes this output stream and forces any buffered output
bytes to be written out.
|
RequestMode |
getMode() |
ByteOrder |
getOrder() |
void |
setBufferSize(int maxsize) |
void |
setMode(RequestMode mode) |
void |
setOrder(ByteOrder order) |
void |
setWriteLimit(long limit) |
void |
write(byte[] b)
Writes b.length bytes from the specified byte array
to this output stream.
|
void |
write(byte[] b,
int off,
int len)
Writes len bytes from the specified byte array starting at
offset off to this output stream.
|
void |
write(int b)
Writes the specified byte to the chunk
|
void |
writeDMR(String dmr)
Write the DMR.
|
void |
writeDSR(String dsr)
Write the DSR; do not bother to cache.
|
void |
writeError(int httpcode,
String msg,
String cxt,
String other)
Write an error chunk.
|
protected static final boolean DEBUG
public static final byte[] CRLF8
protected OutputStream output
protected ChunkWriter.State state
protected int maxbuffersize
protected long writelimit
protected long writecount
protected ByteBuffer chunk
protected ByteBuffer header
protected ByteOrder order
protected RequestMode mode
protected byte[] dmr8
public ChunkWriter(OutputStream output, RequestMode mode, ByteOrder order) throws IOException
IOException
public RequestMode getMode()
public void setMode(RequestMode mode)
public void setBufferSize(int maxsize)
public ByteOrder getOrder()
public void setOrder(ByteOrder order)
public void setWriteLimit(long limit)
public void writeDSR(String dsr) throws IOException
dsr
- The DSR stringIOException
- on IO related errorspublic void writeDMR(String dmr) throws IOException
dmr
- The DMR stringIOException
- on IO related errorspublic void writeError(int httpcode, String msg, String cxt, String other) throws IOException
httpcode
- The httpcode, 0 => ignoremsg
- The cxt
- The other
- The IOException
- on IO related errorspublic void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
- on IO related errorspublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
- on IO related errorspublic void write(byte[] b) throws IOException
write
in class OutputStream
b
- the dataIOException
- if an I/O error occurspublic void write(int b) throws IOException
write
in class OutputStream
b
- the byte to writeIOException
- if an I/O error occurspublic void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
b
- the dataoff
- start point in b from which to write datalen
- number of bytes to writeIOException
- if an I/O error occurspublic static void chunkheader(int length, int flags, ByteBuffer hdrbuf) throws DapException
DapException
Copyright © 1999–2019 UCAR/Unidata. All rights reserved.