Package com.sshtools.common.util
Class TextConversionStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
com.sshtools.common.util.TextConversionStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
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
FieldsModifier and TypeFieldDescriptionstatic final intThis input style instructs the conversion to strip all line ending type characters and replace with the output style line endingstatic final intThis indicates a CR line ending style and can be used for either input or output style parametersstatic final intstatic final intThis indicates a CRLF line ending combinarion and can be used for both input and output style parameters.static final intThis indicates a single LF line ending style and can be used for either input or output style parametersstatic final intThis indicates a MAC line ending and can be used in either the input or output style parametersstatic final intThis output style specifies that the text will have line endings set to the current system setting.static final intThis indicates a LF line ending style and can be used for either input or output style parametersstatic final intThis 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 -
Method Summary
Methods inherited from class java.io.FilterOutputStream
flush, writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
TEXT_SYSTEM
public static final int TEXT_SYSTEMThis 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_WINDOWSThis 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_DOSThis 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_UNIXThis 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_LFThis 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_MACThis 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_CRThis 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_ALLThis 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
-
-
Method Details
-
hasBinary
public boolean hasBinary()Check to see if binary data was encountered during the encoding process- Returns:
- boolean
-
write
- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException
-
write
- Overrides:
writein classFilterOutputStream- Parameters:
buf- byte[]off- intlen- intout- OutputStream- Throws:
IOException
-
main
-