Package com.peterphi.std.io
Class StreamUtil
java.lang.Object
com.peterphi.std.io.StreamUtil
Title: Stream Utility Class
Description: Does useful things with streams
Copyright: Copyright (c) 2006
- Version:
- $Revision$
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final com.peterphi.std.io.StreamUtil.DummyMonitor
A monitor which does nothingstatic final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
doBackgroundCopy
(InputStream isI, OutputStream osI) static void
doBackgroundCopy
(InputStream is, OutputStream os, ICopyProgressMonitor monitor) static void
doBackgroundCopy
(InputStream is, OutputStream os, ICopyProgressMonitor monitor, boolean closeOutput, boolean closeInput) static long
Eats an inputstream, discarding its contentsstatic InputStream
routeStreamThroughProcess
(Process p, InputStream origin, boolean closeInput) Given a Process, this function will route the flow of data through it & out againstatic void
streamCopy
(InputStream in, OutputStream out) static void
streamCopy
(InputStream in, OutputStream out, ICopyProgressMonitor monitor) static void
streamCopy
(InputStream input, Writer output) Copies the contents of an InputStream, using the default encoding, into a Writerstatic void
streamCopy
(Reader reader, Writer writer)
-
Field Details
-
STREAM_SLEEP_TIME
public static final int STREAM_SLEEP_TIME- See Also:
-
CHUNKSIZE
public static final int CHUNKSIZE- See Also:
-
MONITOR_UPDATE_INTERVAL
public static final int MONITOR_UPDATE_INTERVAL- See Also:
-
DUMMY_MONITOR
public static final com.peterphi.std.io.StreamUtil.DummyMonitor DUMMY_MONITORA monitor which does nothing
-
-
Method Details
-
routeStreamThroughProcess
public static InputStream routeStreamThroughProcess(Process p, InputStream origin, boolean closeInput) Given a Process, this function will route the flow of data through it & out again- Parameters:
p
-origin
-closeInput
-- Returns:
-
eatInputStream
Eats an inputstream, discarding its contents- Parameters:
is
- InputStream The input stream to read to the end of- Returns:
- long The size of the stream
-
doBackgroundCopy
-
doBackgroundCopy
-
doBackgroundCopy
public static void doBackgroundCopy(InputStream is, OutputStream os, ICopyProgressMonitor monitor, boolean closeOutput, boolean closeInput) -
streamCopy
-
streamCopy
-
streamCopy
- Throws:
IOException
-
streamCopy
Copies the contents of an InputStream, using the default encoding, into a Writer- Parameters:
input
-output
-- Throws:
IOException
-