Package com.sshtools.common.util
Class EOLProcessor
java.lang.Object
com.sshtools.common.util.EOLProcessor
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 combination 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 combination and can be used for both input and output style parameters. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static InputStreamcreateInputStream(int inputStyle, int outputStyle, InputStream in) static OutputStreamcreateOutputStream(int inputStyle, int outputStyle, OutputStream out) booleanCheck to see if binary data was encountered during the encoding processvoidprocessBytes(byte[] buf, int off, int len)
-
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 combination 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 combination 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
-
EOLProcessor
- Throws:
IOException
-
-
Method Details
-
hasBinary
public boolean hasBinary()Check to see if binary data was encountered during the encoding process- Returns:
- boolean
-
close
- Throws:
IOException
-
processBytes
- Parameters:
buf- byte[]off- intlen- intcurrentOut- OutputStream- Throws:
IOException
-
createOutputStream
public static OutputStream createOutputStream(int inputStyle, int outputStyle, OutputStream out) throws IOException - Throws:
IOException
-
createInputStream
public static InputStream createInputStream(int inputStyle, int outputStyle, InputStream in) throws IOException - Throws:
IOException
-