public class ChunkWriter
extends java.io.OutputStream
| Modifier and Type | Class and Description |
|---|---|
protected static class |
ChunkWriter.State |
| Modifier and Type | Field and Description |
|---|---|
protected java.nio.ByteBuffer |
chunk |
static byte[] |
CRLF8 |
protected static boolean |
DEBUG |
protected byte[] |
dmr8 |
protected java.nio.ByteBuffer |
header |
protected int |
maxbuffersize |
protected dap4.dap4shared.RequestMode |
mode |
protected java.nio.ByteOrder |
order |
protected java.io.OutputStream |
output |
protected ChunkWriter.State |
state |
protected long |
writecount |
protected long |
writelimit |
| Constructor and Description |
|---|
ChunkWriter(java.io.OutputStream output,
dap4.dap4shared.RequestMode mode,
java.nio.ByteOrder order) |
| Modifier and Type | Method and Description |
|---|---|
static void |
chunkheader(int length,
int flags,
java.nio.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.
|
dap4.dap4shared.RequestMode |
getMode() |
java.nio.ByteOrder |
getOrder() |
void |
setBufferSize(int maxsize) |
void |
setMode(dap4.dap4shared.RequestMode mode) |
void |
setOrder(java.nio.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(java.lang.String dmr)
Write the DMR.
|
void |
writeDSR(java.lang.String dsr)
Write the DSR; do not bother to cache.
|
void |
writeError(int httpcode,
java.lang.String msg,
java.lang.String cxt,
java.lang.String other)
Write an error chunk.
|
protected static final boolean DEBUG
public static final byte[] CRLF8
protected java.io.OutputStream output
protected ChunkWriter.State state
protected int maxbuffersize
protected long writelimit
protected long writecount
protected java.nio.ByteBuffer chunk
protected java.nio.ByteBuffer header
protected java.nio.ByteOrder order
protected dap4.dap4shared.RequestMode mode
protected byte[] dmr8
public ChunkWriter(java.io.OutputStream output,
dap4.dap4shared.RequestMode mode,
java.nio.ByteOrder order)
throws java.io.IOException
java.io.IOExceptionpublic dap4.dap4shared.RequestMode getMode()
public void setMode(dap4.dap4shared.RequestMode mode)
public void setBufferSize(int maxsize)
public java.nio.ByteOrder getOrder()
public void setOrder(java.nio.ByteOrder order)
public void setWriteLimit(long limit)
public void writeDSR(java.lang.String dsr)
throws java.io.IOException
dsr - The DSR stringjava.io.IOException - on IO related errorspublic void writeDMR(java.lang.String dmr)
throws java.io.IOException
dmr - The DMR stringjava.io.IOException - on IO related errorspublic void writeError(int httpcode,
java.lang.String msg,
java.lang.String cxt,
java.lang.String other)
throws java.io.IOException
httpcode - The httpcode, 0 => ignoremsg - The cxt - The other - The java.io.IOException - on IO related errorspublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOException - on IO related errorspublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOException - on IO related errorspublic void write(byte[] b)
throws java.io.IOException
write in class java.io.OutputStreamb - the datajava.io.IOException - if an I/O error occurspublic void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamb - the byte to writejava.io.IOException - if an I/O error occurspublic void write(byte[] b,
int off,
int len)
throws java.io.IOException
write in class java.io.OutputStreamb - the dataoff - start point in b from which to write datalen - number of bytes to writejava.io.IOException - if an I/O error occurspublic static void chunkheader(int length,
int flags,
java.nio.ByteBuffer hdrbuf)
throws dap4.core.util.DapException
dap4.core.util.DapException