- java.lang.Object
-
- java.io.OutputStream
-
- org.refcodes.io.LineBreakOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class LineBreakOutputStream extends OutputStream
ALineBreakOutputStreamwraps anOutputStreamfor adding line breaks after a given number of bytes being written.
-
-
Constructor Summary
Constructors Constructor Description LineBreakOutputStream(OutputStream aOutputStream, int aLineWidth)Constructs aLineBreakOutputStreamwith the given arguments used for configuration.LineBreakOutputStream(OutputStream aOutputStream, int aLineWidth, String aLineBreak)Constructs aLineBreakOutputStreamwith the given arguments used for configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()voidwrite(int aByte)-
Methods inherited from class java.io.OutputStream
nullOutputStream, write, write
-
-
-
-
Constructor Detail
-
LineBreakOutputStream
public LineBreakOutputStream(OutputStream aOutputStream, int aLineWidth, String aLineBreak)
Constructs aLineBreakOutputStreamwith the given arguments used for configuration.- Parameters:
aOutputStream- TheOutputStreamto be wrapped.aLineWidth- The line with 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
public LineBreakOutputStream(OutputStream aOutputStream, int aLineWidth)
Constructs aLineBreakOutputStreamwith the given arguments used for configuration. The line break characters used are the ones used by the underlying operating system.- Parameters:
aOutputStream- TheOutputStreamto be wrapped.aLineWidth- The line with after which to insert a line break, a line width of -1 does not insert any line breaks at all.
-
-
Method Detail
-
write
public void write(int aByte) throws IOException- Specified by:
writein classOutputStream- Throws:
IOException
-
flush
public void flush() throws IOException- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-
-