Package cx.ath.matthew.io
Class TeeInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
cx.ath.matthew.io.TeeInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
Class to copy a stream to a file or another stream as it is being sent through a stream pipe
E.g.
Reader r = new InputStreamReader(new TeeInputStream(new FileInputStream("file"), new File("otherfile")));
-
Constructor Summary
ConstructorsConstructorDescriptionTeeInputStream
(InputStream is, File f) Create a new TeeInputStream on the given InputStream and copy the stream to the given File.TeeInputStream
(InputStream is, File f, boolean append) Create a new TeeInputStream on the given InputStream and copy the stream to the given File.TeeInputStream
(InputStream is, OutputStream tos) Create a new TeeInputStream on the given InputStream and copy the stream to the given File.TeeInputStream
(InputStream is, String f) Create a new TeeInputStream on the given InputStream and copy the stream to the given File.TeeInputStream
(InputStream is, String f, boolean append) Create a new TeeInputStream on the given InputStream and copy the stream to the given File. -
Method Summary
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Constructor Details
-
TeeInputStream
Create a new TeeInputStream on the given InputStream and copy the stream to the given File.- Parameters:
is
- Reads from this InputStreamtos
- Write to this OutputStream- Throws:
IOException
-
TeeInputStream
Create a new TeeInputStream on the given InputStream and copy the stream to the given File.- Parameters:
is
- Reads from this InputStreamf
- Write to this Fileappend
- Append to file not overwrite- Throws:
IOException
-
TeeInputStream
Create a new TeeInputStream on the given InputStream and copy the stream to the given File.- Parameters:
is
- Reads from this InputStreamf
- Write to this File- Throws:
IOException
-
TeeInputStream
Create a new TeeInputStream on the given InputStream and copy the stream to the given File.- Parameters:
is
- Reads from this InputStreamf
- Write to this Fileappend
- Append to file not overwrite- Throws:
IOException
-
TeeInputStream
Create a new TeeInputStream on the given InputStream and copy the stream to the given File.- Parameters:
is
- Reads from this InputStreamf
- Write to this File- Throws:
IOException
-
-
Method Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
- Throws:
IOException
-
flush
- Throws:
IOException
-
available
- Overrides:
available
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
skip
- Overrides:
skip
in classFilterInputStream
- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
mark
in classFilterInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classFilterInputStream
-
reset
- Overrides:
reset
in classFilterInputStream
- Throws:
IOException
-
finalize
public void finalize()
-