Package slash.common.io
Class InputOutput
java.lang.Object
slash.common.io.InputOutput
As a pipe reads from input and writes to output.
- Author:
- Christian Pesch
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcopyAndClose(InputStream inputStream, OutputStream outputStream) static voidcopyAndClose(Reader reader, Writer writer) static ReaderReturns aReaderfor legacy/garbled XML that carries no encoding declaration: decodes as UTF-8 when the bytes are valid UTF-8, otherwise falls back to Windows-1252 (the common legacy code page).static byte[]readBytes(InputStream input) static StringreadFileToString(File file)
-
Field Details
-
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE- See Also:
-
-
Constructor Details
-
InputOutput
public InputOutput()
-
-
Method Details
-
copyAndClose
public static void copyAndClose(InputStream inputStream, OutputStream outputStream) throws IOException - Throws:
IOException
-
copyAndClose
- Throws:
IOException
-
readBytes
- Throws:
IOException
-
readFileToString
- Throws:
IOException
-
readAsReaderPreferringUtf8
Returns aReaderfor legacy/garbled XML that carries no encoding declaration: decodes as UTF-8 when the bytes are valid UTF-8, otherwise falls back to Windows-1252 (the common legacy code page). Deterministic and independent of the platform default charset, which changed to UTF-8 in JDK 18 (JEP 400) and previously made this depend on the host locale.- Throws:
IOException
-