public class LimitedOutputStream extends OutputStream
Content-Length
headers. This stream is
unsynchronized.LimitedInputStream
Constructor and Description |
---|
LimitedOutputStream(OutputStream stream,
int lengthLimit)
Constructs a limited output stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying output stream.
|
void |
flush()
Flushes the underlying output stream.
|
String |
toString()
Returns a debug string.
|
void |
write(byte[] b,
int off,
int len)
Writes up to
len bytes of data to the output stream,
possibly less if the write limit is reached. |
void |
write(int b)
Writes a byte of data to the output stream,
possibly does nothing if the write limit is reached.
|
write
public LimitedOutputStream(OutputStream stream, int lengthLimit)
stream
- must be non-null.lengthLimit
- limit of bytes of output.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
len
bytes of data to the output stream,
possibly less if the write limit is reached.write
in class OutputStream
IOException
public void write(int b) throws IOException
write
in class OutputStream
IOException
Copyright © 2012. All Rights Reserved.