java.lang.Object
java.io.OutputStream
org.refcodes.io.LineBreakOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
A
LineBreakOutputStream
wraps an OutputStream
for adding line
breaks after a given number of bytes being written.-
Constructor Summary
ConstructorDescriptionLineBreakOutputStream
(OutputStream aOutputStream, int aLineWidth) Constructs aLineBreakOutputStream
with the given arguments used for configuration.LineBreakOutputStream
(OutputStream aOutputStream, int aLineWidth, boolean isFlushLineBreak) Constructs aLineBreakOutputStream
with the given arguments used for configuration.LineBreakOutputStream
(OutputStream aOutputStream, int aLineWidth, String aLineBreak) Constructs aLineBreakOutputStream
with the given arguments used for configuration.LineBreakOutputStream
(OutputStream aOutputStream, int aLineWidth, String aLineBreak, boolean isFlushLineBreak) Constructs aLineBreakOutputStream
with the given arguments used for configuration. -
Method Summary
Methods inherited from class java.io.OutputStream
nullOutputStream, write, write
-
Constructor Details
-
LineBreakOutputStream
Constructs aLineBreakOutputStream
with the given arguments used for configuration.- Parameters:
aOutputStream
- TheOutputStream
to be wrapped.aLineWidth
- The line width after which to insert a line break, a line width of -1 does not insert any line breaks at all.aLineBreak
- The line break chars to use.
-
LineBreakOutputStream
Constructs aLineBreakOutputStream
with the given arguments used for configuration. The line break characters used are the ones used by the underlying operating system.- Parameters:
aOutputStream
- TheOutputStream
to be wrapped.aLineWidth
- The line width after which to insert a line break, a line width of -1 does not insert any line breaks at all.
-
LineBreakOutputStream
public LineBreakOutputStream(OutputStream aOutputStream, int aLineWidth, String aLineBreak, boolean isFlushLineBreak) Constructs aLineBreakOutputStream
with the given arguments used for configuration.- Parameters:
aOutputStream
- TheOutputStream
to be wrapped.aLineWidth
- The line width after which to insert a line break, a line width of -1 does not insert any line breaks at all.aLineBreak
- The line break chars to use.isFlushLineBreak
- When true, then a line break is also inserted upon aflush()
operation.
-
LineBreakOutputStream
Constructs aLineBreakOutputStream
with the given arguments used for configuration. The line break characters used are the ones used by the underlying operating system.- Parameters:
aOutputStream
- TheOutputStream
to be wrapped.aLineWidth
- The line width after which to insert a line break, a line width of -1 does not insert any line breaks at all.isFlushLineBreak
- When true, then a line break is also inserted upon aflush()
operation.
-
-
Method Details
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-