Package de.intarsys.tools.stream
Class StreamTools
java.lang.Object
de.intarsys.tools.stream.StreamTools
A tool class for the handling of streams.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic void
close
(IRandomAccess ra) static void
close
(InputStream is) static void
close
(OutputStream os) static void
static void
static void
static void
copyEncoded
(Reader reader, Writer writer) static void
copyEncodedStream
(InputStream source, String sourceEncoding, OutputStream destination, String destinationEncoding) static void
copyStream
(InputStream source, boolean closeInput, OutputStream destination, boolean closeOutput) Kopiert einen Eingabedatenstrom auf einen Ausgabedatenstrom.static void
copyStream
(InputStream source, OutputStream destination) Kopiert einen Stream.static void
copyStream
(InputStream source, OutputStream destination, long length) Kopiert einen Eingabedatenstrom auf einen Ausgabedatenstrom.static byte[]
static String
toString
(InputStream is, String encoding) static String
-
Field Details
-
MAX_BUFFER
public static final int MAX_BUFFER- See Also:
-
-
Method Details
-
close
-
close
-
close
-
close
-
close
-
close
-
copyEncoded
- Throws:
IOException
-
copyEncodedStream
public static void copyEncodedStream(InputStream source, String sourceEncoding, OutputStream destination, String destinationEncoding) throws IOException - Throws:
IOException
-
copyStream
public static void copyStream(InputStream source, boolean closeInput, OutputStream destination, boolean closeOutput) throws IOException Kopiert einen Eingabedatenstrom auf einen Ausgabedatenstrom. Anschließend (finally) werden die Datenströme geschlossen(!), sofern dies in den Parametern angegeben wurde. Fehler beim Schließen der Datenströme werden ignoriert.- Parameters:
source
- EingabedatenstromcloseInput
- Angabe ob der InputStream nach dem Kopieren geschlossen werden soll.destination
- AusgabedatenstromcloseOutput
- Angabe ob der OutputStream nach dem Kopieren geschlossen werden soll.- Throws:
IOException
- Fehler allgemein oder beim Kopieren.
-
copyStream
Kopiert einen Stream. Ruft copyStream(in, true, out, true) auf.- Parameters:
source
- Eingabedatenstrom, der kopiert werden soll.destination
- Ausgabestrom, auf den kopiert werden soll.- Throws:
IOException
- See Also:
-
copyStream
public static void copyStream(InputStream source, OutputStream destination, long length) throws IOException Kopiert einen Eingabedatenstrom auf einen Ausgabedatenstrom.- Parameters:
source
- Eingabedatenstromdestination
- Ausgabedatenstromlength
- Anzahl der zu lesenden bytes- Throws:
IOException
-
toByteArray
- Throws:
IOException
-
toString
- Throws:
IOException
-
toString
- Throws:
IOException
-