public final class MeteredStream extends OutputStream
Constructor and Description |
---|
MeteredStream(OutputStream out,
long written)
Create the stream wrapped around the specified output stream.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the output stream which closes the target output stream.
|
void |
flush()
Flush the output stream which flushes the target output stream.
|
long |
getBytesWritten()
Returns the number of bytes written in this stream.
|
void |
write(byte[] buff)
Write the specified buffer to the stream.
|
void |
write(byte[] buff,
int off,
int len)
Write the specified buffer to the stream.
|
void |
write(int b)
Write the specified byte to the stream.
|
public MeteredStream(OutputStream out, long written)
out
- The target output stream to keep track of.written
- The number of bytes written to the stream.public void write(int b) throws IOException
write
in class OutputStream
b
- The value to be written to the stream.IOException
- if the write failed.public void write(byte[] buff) throws IOException
write
in class OutputStream
buff
- The value to be written to the stream.IOException
- if the write failed.public void write(byte[] buff, int off, int len) throws IOException
write
in class OutputStream
buff
- The value to be written to the stream.off
- The offset to write from.len
- The length of the buffer to write.IOException
- if the write failed.public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
- if the flush failed.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
- if the close failed.public long getBytesWritten()
Copyright © 2025 Open Identity Platform Community. All rights reserved.