public final class NoThrowOutputStream extends OutputStream
IOException
s
to our own NoThrowOutputStream.HiddenException
, which is a subclass of RuntimeException
. This
means that the methods don't have IOException
in their throws
clauses.
NOTE: The name is slightly misleading in that these methods still might throw an
IOException
wrapped in a HiddenException
, just not an
IOException
directly.
Also, it does have IOException
in the throws
clause of close()
,
but you're not supposed to call that method.
Modifier and Type | Class and Description |
---|---|
static class |
NoThrowOutputStream.HiddenException |
Constructor and Description |
---|
NoThrowOutputStream(OutputStream underlying) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
long |
getBytesWritten() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public NoThrowOutputStream(OutputStream underlying)
public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
public void flush()
flush
in interface Flushable
flush
in class OutputStream
public void write(byte[] b, int off, int len)
write
in class OutputStream
public void write(byte[] b)
write
in class OutputStream
public void write(int b)
write
in class OutputStream
public long getBytesWritten()