Class TextConversionStream

java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
com.sshtools.common.util.TextConversionStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class TextConversionStream extends FilterOutputStream

This class processes text data and corrects line endings according to the settings provided. Specifically you can set the input style to process so that lone \r and \n characters within a \r\n encoded file are written through without amendments (the SFTP protocol states that this must be the case when processing text files).

Author:
Lee David Painter
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    This input style instructs the conversion to strip all line ending type characters and replace with the output style line ending
    static final int
    This indicates a CR line ending style and can be used for either input or output style parameters
    static final int
     
    static final int
    This indicates a CRLF line ending combinarion and can be used for both input and output style parameters.
    static final int
    This indicates a single LF line ending style and can be used for either input or output style parameters
    static final int
    This indicates a MAC line ending and can be used in either the input or output style parameters
    static final int
    This output style specifies that the text will have line endings set to the current system setting.
    static final int
    This indicates a LF line ending style and can be used for either input or output style parameters
    static final int
    This indicates a CRLF line ending combinarion and can be used for both input and output style parameters.

    Fields inherited from class java.io.FilterOutputStream

    out
  • Constructor Summary

    Constructors
    Constructor
    Description
    TextConversionStream(int inputStyle, int outputStyle, OutputStream out)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    boolean
    Check to see if binary data was encountered during the encoding process
    static void
    main(String[] args)
     
    void
    write(byte[] buf, int off, int len)
     
    void
    write(int b)
     

    Methods inherited from class java.io.FilterOutputStream

    flush, write

    Methods inherited from class java.io.OutputStream

    nullOutputStream

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • TEXT_SYSTEM

      public static final int TEXT_SYSTEM
      This output style specifies that the text will have line endings set to the current system setting.
      See Also:
    • TEXT_WINDOWS

      public static final int TEXT_WINDOWS
      This indicates a CRLF line ending combinarion and can be used for both input and output style parameters.
      See Also:
    • TEXT_DOS

      public static final int TEXT_DOS
      This indicates a CRLF line ending combinarion and can be used for both input and output style parameters.
      See Also:
    • TEXT_CRLF

      public static final int TEXT_CRLF
      See Also:
    • TEXT_UNIX

      public static final int TEXT_UNIX
      This indicates a LF line ending style and can be used for either input or output style parameters
      See Also:
    • TEXT_LF

      public static final int TEXT_LF
      This indicates a single LF line ending style and can be used for either input or output style parameters
      See Also:
    • TEXT_MAC

      public static final int TEXT_MAC
      This indicates a MAC line ending and can be used in either the input or output style parameters
      See Also:
    • TEXT_CR

      public static final int TEXT_CR
      This indicates a CR line ending style and can be used for either input or output style parameters
      See Also:
    • TEXT_ALL

      public static final int TEXT_ALL
      This input style instructs the conversion to strip all line ending type characters and replace with the output style line ending
      See Also:
  • Constructor Details

    • TextConversionStream

      public TextConversionStream(int inputStyle, int outputStyle, OutputStream out)
  • Method Details