java.lang.Object
java.io.InputStream
org.refcodes.io.ReplaceInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
The
ReplaceInputStream
replaces a give byte sequence with another
given bytes sequence.-
Constructor Summary
ConstructorDescriptionReplaceInputStream
(InputStream aInputStream, byte[] aFindBytes, byte[] aReplaceBytes) Constructs aReplaceInputStream
from the givenInputStream
replacing given bytes with replacement bytes.ReplaceInputStream
(InputStream aInputStream, String aFindBytes, String aReplaceBytes) Constructs aReplaceInputStream
from the givenInputStream
replacing given bytes with replacement bytes.ReplaceInputStream
(InputStream aInputStream, String aFindBytes, String aReplaceBytes, Charset aCharset) Constructs aReplaceInputStream
from the givenInputStream
replacing given bytes with replacement bytes. -
Method Summary
Methods inherited from class java.io.InputStream
nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, skip, skipNBytes, transferTo
-
Constructor Details
-
ReplaceInputStream
Constructs aReplaceInputStream
from the givenInputStream
replacing given bytes with replacement bytes.- Parameters:
aInputStream
- TheInputStream
to be manipulated accordingly.aFindBytes
- The bytes to replace.aReplaceBytes
- The replacement bytes.
-
ReplaceInputStream
Constructs aReplaceInputStream
from the givenInputStream
replacing given bytes with replacement bytes.- Parameters:
aInputStream
- TheInputStream
to be manipulated accordingly.aFindBytes
- TheString
containing the bytes to replace.aReplaceBytes
- TheString
containing the replacement bytes.
-
ReplaceInputStream
public ReplaceInputStream(InputStream aInputStream, String aFindBytes, String aReplaceBytes, Charset aCharset) Constructs aReplaceInputStream
from the givenInputStream
replacing given bytes with replacement bytes.- Parameters:
aInputStream
- TheInputStream
to be manipulated accordingly.aFindBytes
- TheString
containing the bytes to replace.aReplaceBytes
- TheString
containing the replacement bytes.aCharset
- TheCharset
to be used when converting the providedString
texts into bytes.
-
-
Method Details
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
available
- Overrides:
available
in classInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
mark
public void mark(int aReadlimit) - Overrides:
mark
in classInputStream
-
reset
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classInputStream
-