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).
Modifier and Type | Field and Description |
---|---|
static int |
TEXT_ALL
This input style instructs the conversion to strip
all line ending type characters and replace with the output style
line ending
|
static int |
TEXT_CR
This indicates a CR line ending style and can be used for either
input or output style parameters
|
static int |
TEXT_CRLF |
static int |
TEXT_DOS
This indicates a CRLF line ending combinarion and can be used
for both input and output style parameters.
|
static int |
TEXT_LF
This indicates a single LF line ending style and can be used for
either input or output style parameters
|
static int |
TEXT_MAC
This indicates a MAC line ending and can be used in either the
input or output style parameters
|
static int |
TEXT_SYSTEM
This output style specifies that the text will have line endings set to
the current system setting.
|
static int |
TEXT_UNIX
This indicates a LF line ending style and can be
used for either input or output style parameters
|
static int |
TEXT_WINDOWS
This indicates a CRLF line ending combinarion and can be used
for both input and output style parameters.
|
out
Constructor and Description |
---|
TextConversionStream(int inputStyle,
int outputStyle,
OutputStream out) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
hasBinary()
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) |
flush, write
public static final int TEXT_SYSTEM
public static final int TEXT_WINDOWS
public static final int TEXT_DOS
public static final int TEXT_CRLF
public static final int TEXT_UNIX
public static final int TEXT_LF
public static final int TEXT_MAC
public static final int TEXT_CR
public static final int TEXT_ALL
public TextConversionStream(int inputStyle, int outputStyle, OutputStream out)
public boolean hasBinary()
public void write(int b) throws IOException
write
in class FilterOutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterOutputStream
IOException
public void write(byte[] buf, int off, int len) throws IOException
write
in class FilterOutputStream
buf
- byte[]off
- intlen
- intout
- OutputStreamIOException
public static void main(String[] args)
Copyright © 2024. All rights reserved.