Package com.dtolabs.utils
Class Streams
- java.lang.Object
-
- com.dtolabs.utils.Streams
-
public class Streams extends java.lang.Object
Streams utility class for reading and writing streams
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Streams.StreamCopyThread
A simple Thread subclass that performs a stream copy from an InputStream to an OutputStream.
-
Constructor Summary
Constructors Constructor Description Streams()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
copyStream(java.io.InputStream in, java.io.OutputStream out)
Read the data from the input stream and copy to the outputstream.static int
copyStreamCount(java.io.InputStream in, java.io.OutputStream out)
Read the data from the input stream and copy to the outputstream.static Streams.StreamCopyThread
copyStreamThread(java.io.InputStream in, java.io.OutputStream out)
Return a new thread that will copy an inputstream to an output stream.static void
copyStreamWithFilterSet(java.io.InputStream in, java.io.OutputStream out, org.apache.tools.ant.types.FilterSet set)
Read the data from the input stream and write to the outputstream, filtering with an Ant FilterSet.static int
copyWriterCount(java.io.Reader in, java.io.Writer out)
Read the data from the reader and copy to the writer.
-
-
-
Method Detail
-
copyStream
public static long copyStream(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
Read the data from the input stream and copy to the outputstream.- Parameters:
in
- inputstreamout
- outpustream- Returns:
- bytes copied
- Throws:
java.io.IOException
- if thrown by underlying io operations
-
copyStreamCount
public static int copyStreamCount(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
Read the data from the input stream and copy to the outputstream.- Parameters:
in
- inputstreamout
- outpustream- Returns:
- number of bytes copied
- Throws:
java.io.IOException
- if thrown by underlying io operations
-
copyWriterCount
public static int copyWriterCount(java.io.Reader in, java.io.Writer out) throws java.io.IOException
Read the data from the reader and copy to the writer.- Parameters:
in
- inputstreamout
- outpustream- Returns:
- number of bytes copied
- Throws:
java.io.IOException
- if thrown by underlying io operations
-
copyStreamThread
public static Streams.StreamCopyThread copyStreamThread(java.io.InputStream in, java.io.OutputStream out)
Return a new thread that will copy an inputstream to an output stream. You must start the thread.- Parameters:
in
- inputstreamout
- outputstream- Returns:
- an unstarted
Streams.StreamCopyThread
-
copyStreamWithFilterSet
public static void copyStreamWithFilterSet(java.io.InputStream in, java.io.OutputStream out, org.apache.tools.ant.types.FilterSet set) throws java.io.IOException
Read the data from the input stream and write to the outputstream, filtering with an Ant FilterSet.- Parameters:
in
- inputstreamout
- outputstreamset
- FilterSet to use- Throws:
java.io.IOException
- if thrown by underlying io operations
-
-