Closeable
, AutoCloseable
public 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, toString
readAllBytes, readNBytes, transferTo
public 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 DelegatingInputStream
IOException
public int read(byte[] buffer) throws IOException
read
in class DelegatingInputStream
IOException
public int read(byte[] buffer, int off, int len) throws IOException
read
in class DelegatingInputStream
IOException
public long skip(long n) throws IOException
DelegatingInputStream
InputStream.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 DelegatingInputStream
n
- is the number bytes to skip.IOException
public void close() throws IOException
close
in interface AutoCloseable
close
in interface Closeable
close
in class DelegatingInputStream
IOException
Copyright © 2017–2018 PureSol Technologies. All rights reserved.