Class LineBreakOutputStream

java.lang.Object
java.io.OutputStream
org.refcodes.io.LineBreakOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class LineBreakOutputStream extends OutputStream
A LineBreakOutputStream wraps an OutputStream for adding line breaks after a given number of bytes being written.
  • Constructor Details

    • LineBreakOutputStream

      public LineBreakOutputStream(OutputStream aOutputStream, int aLineWidth, String aLineBreak)
      Constructs a LineBreakOutputStream with the given arguments used for configuration.
      Parameters:
      aOutputStream - The OutputStream 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

      public LineBreakOutputStream(OutputStream aOutputStream, int aLineWidth)
      Constructs a LineBreakOutputStream with the given arguments used for configuration. The line break characters used are the ones used by the underlying operating system.
      Parameters:
      aOutputStream - The OutputStream 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 a LineBreakOutputStream with the given arguments used for configuration.
      Parameters:
      aOutputStream - The OutputStream 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 a flush() operation.
    • LineBreakOutputStream

      public LineBreakOutputStream(OutputStream aOutputStream, int aLineWidth, boolean isFlushLineBreak)
      Constructs a LineBreakOutputStream with the given arguments used for configuration. The line break characters used are the ones used by the underlying operating system.
      Parameters:
      aOutputStream - The OutputStream 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 a flush() operation.
  • Method Details