Package com.dropbox.core
Class NoThrowInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.dropbox.core.NoThrowInputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public final class NoThrowInputStream extends java.io.InputStream
Wraps an existing input stream, converting all the underlying stream'sIOException
s to our ownNoThrowInputStream.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
NoThrowInputStream.HiddenException
-
Constructor Summary
Constructors Constructor Description NoThrowInputStream(java.io.InputStream underlying)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
long
getBytesRead()
int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
-
-
-
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.InputStream
-
read
public int read()
- Specified by:
read
in classjava.io.InputStream
-
read
public int read(byte[] b, int off, int len)
- Overrides:
read
in classjava.io.InputStream
-
read
public int read(byte[] b)
- Overrides:
read
in classjava.io.InputStream
-
getBytesRead
public long getBytesRead()
-
-