Closeable, AutoCloseablepublic class CopyingInputStream extends DelegatingInputStream
| Constructor | Description |
|---|---|
CopyingInputStream(InputStream inputStream,
OutputStream outputStream) |
This constructor is used to initialize the copying input stream.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
|
boolean |
equals(Object obj) |
|
int |
hashCode() |
|
int |
read() |
|
int |
read(byte[] buffer) |
|
int |
read(byte[] buffer,
int off,
int len) |
|
long |
skip(long n) |
This method overrides the
InputStream.skip(long) method to extend the
contract of the method:
This method tries to skip n bytes until the end of the stream or until an
exception is thrown. |
available, mark, markSupported, reset, toStringreadAllBytes, readNBytes, transferTopublic CopyingInputStream(InputStream inputStream, OutputStream outputStream)
inputStream - is the input stream to read from.outputStream - is the output stream to copy every byte read from input stream to.public int read()
throws IOException
read in class DelegatingInputStreamIOExceptionpublic int read(byte[] buffer)
throws IOException
read in class DelegatingInputStreamIOExceptionpublic int read(byte[] buffer,
int off,
int len)
throws IOException
read in class DelegatingInputStreamIOExceptionpublic long skip(long n)
throws IOException
DelegatingInputStreamInputStream.skip(long) method to extend the
contract of the method:
BufferedInputStream only skip a certain amount of bytes (in this
case until the end of the current buffer) with the first call. Subsequent
calls skip more bytes later on. This is fixed here.skip in class DelegatingInputStreamn - is the number bytes to skip.IOExceptionpublic void close()
throws IOException
close in interface AutoCloseableclose in interface Closeableclose in class DelegatingInputStreamIOExceptionCopyright © 2017–2018 PureSol Technologies. All rights reserved.