Package com.adobe.internal.io
Class TagSearchingOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- com.adobe.internal.io.TagSearchingOutputStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class TagSearchingOutputStream extends FilterOutputStream
AnOutputStream
that searches for a specific tag in the data stream and when found it calls back.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
TagSearchingOutputStream.Callback
The mechanism to let the client know that the tag has been found.
-
Constructor Summary
Constructors Constructor Description TagSearchingOutputStream(OutputStream out, byte[] tag, TagSearchingOutputStream.Callback callback)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
int
outputTag()
Queries whether the tag being searched for is output or not and if so if it is before or after the call toTagSearchingOutputStream.Callback.tagFound(TagSearchingOutputStream)
.int
outputTag(int tagOutput)
Sets whether the tag being searched for is output or not and if so if it is before or after the call toTagSearchingOutputStream.Callback.tagFound(TagSearchingOutputStream)
.boolean
searchForTag()
Query whether the tag searching is turned on or off.boolean
searchForTag(boolean search)
Turn on or off the tag searching.void
write(int b)
-
Methods inherited from class java.io.FilterOutputStream
flush, write, write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Constructor Detail
-
TagSearchingOutputStream
public TagSearchingOutputStream(OutputStream out, byte[] tag, TagSearchingOutputStream.Callback callback) throws IOException
Constructor.- Throws:
IOException
-
-
Method Detail
-
searchForTag
public boolean searchForTag(boolean search) throws IOException
Turn on or off the tag searching. This must not be called during theTagSearchingOutputStream.Callback.tagFound(TagSearchingOutputStream)
. If tag searching should be turned off after the return from the callback then the client can use the return value from the callback method to turn searching off.- Parameters:
search
-true
if tag should be searched for;false
otherwise- Returns:
- the tag search state before the call
- Throws:
IOException
-
searchForTag
public boolean searchForTag() throws IOException
Query whether the tag searching is turned on or off.- Returns:
- the current tag search state
true
if tag searching is on;false
otherwise - Throws:
IOException
-
outputTag
public int outputTag(int tagOutput) throws IOException
Sets whether the tag being searched for is output or not and if so if it is before or after the call toTagSearchingOutputStream.Callback.tagFound(TagSearchingOutputStream)
. By default the tag being searched for will not be output.- Parameters:
tagOutput
-0
if tag should not be output;-1
(or any -ve number) if the tag should be output before the callback;1
(or any +ve number) if the tag should be output after the callback- Returns:
- the tag output state before the call
- Throws:
IOException
-
outputTag
public int outputTag() throws IOException
Queries whether the tag being searched for is output or not and if so if it is before or after the call toTagSearchingOutputStream.Callback.tagFound(TagSearchingOutputStream)
. By default the tag being searched for will not be output.-1
(or any -ve number) if the tag should be output before the callback;1
(or any +ve number) if thte tag should be output after the callback- Returns:
- the current tag output state
0
if tag should not be output;-1
(or any -ve number) if the tag should be output before the callback;1
(or any +ve number) if the tag should be output after the callback - Throws:
IOException
-
write
public void write(int b) throws IOException
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
-
-