Package com.dropbox.core
Class NoThrowOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.dropbox.core.NoThrowOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
public final class NoThrowOutputStream extends java.io.OutputStream
Wraps an existing output stream, converting all the underlying stream'sIOException
s to our ownNoThrowOutputStream.HiddenException
, which is a subclass ofRuntimeException
. This means that the methods don't haveIOException
in theirthrows
clauses.NOTE: The name is slightly misleading in that these methods still might throw an
IOException
wrapped in aHiddenException
, just not anIOException
directly.Also, it does have
IOException
in thethrows
clause ofclose()
, but you're not supposed to call that method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NoThrowOutputStream.HiddenException
-
Constructor Summary
Constructors Constructor Description NoThrowOutputStream(java.io.OutputStream underlying)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
long
getBytesWritten()
void
write(byte[] b)
void
write(byte[] b, int off, int len)
void
write(int b)
-
-
-
Method Detail
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.OutputStream
-
flush
public void flush()
- Specified by:
flush
in interfacejava.io.Flushable
- Overrides:
flush
in classjava.io.OutputStream
-
write
public void write(byte[] b, int off, int len)
- Overrides:
write
in classjava.io.OutputStream
-
write
public void write(byte[] b)
- Overrides:
write
in classjava.io.OutputStream
-
write
public void write(int b)
- Specified by:
write
in classjava.io.OutputStream
-
getBytesWritten
public long getBytesWritten()
-
-