Class FilteredOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
com.cloudbees.jenkins.support.filter.FilteredOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public class FilteredOutputStream
extends FilterOutputStream
Wraps an OutputStream by filtering written lines using a provided ContentFilter.
Data written to an instance of this will be decoded on the fly using the provided charset, and each line
written is filtered.
- Since:
- TODO
- See Also:
-
Field Summary
FieldsFields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
ConstructorsConstructorDescriptionFilteredOutputStream
(OutputStream out, ContentFilter contentFilter) Constructs a filtered stream using the provided filter and assuming UTF-8.FilteredOutputStream
(OutputStream out, Charset charset, ContentFilter contentFilter) Constructs a filtered stream using the provided filter and charset. -
Method Summary
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
UNKNOWN_INPUT
- See Also:
-
-
Constructor Details
-
FilteredOutputStream
Constructs a filtered stream using the provided filter and assuming UTF-8.- Parameters:
out
- output stream to write filtered content tocontentFilter
- content filter to apply to lines written through this stream
-
FilteredOutputStream
public FilteredOutputStream(@NonNull OutputStream out, @NonNull Charset charset, @NonNull ContentFilter contentFilter) Constructs a filtered stream using the provided filter and charset.- Parameters:
out
- output stream to write filtered content tocharset
- character set to use for decoding and encoding bytes written to this streamcontentFilter
- content filter to apply to lines written through this stream
-
-
Method Details
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
flush
Flushes the current buffered contents and filters them as is.- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classFilterOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterOutputStream
- Throws:
IOException
-
reset
public void reset()Resets the state of this stream's decoders and buffers. -
asWriter
- Returns:
- a FilteredWriter view of this stream's underlying OutputStream
-