net.java.trueupdate.core.io
Class Copy
java.lang.Object
net.java.trueupdate.core.io.Copy
@Immutable
public final class Copy
- extends Object
Provides a high-performance copy function.
- Author:
- Christian Schlichtherle (copied and edited from the
Streams class in TrueCommons I/O 2.3.2)
|
Nested Class Summary |
static class |
Copy.ReaderThread
A pooled and cached daemon thread which runs tasks to read input streams. |
|
Method Summary |
static void |
copy(Source source,
Sink sink)
Copies the data from the given source to the given sink. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
copy
public static void copy(Source source,
Sink sink)
throws InputException,
IOException
- Copies the data from the given source to the given sink.
This is a high performance implementation which uses a pooled background
thread to fill a FIFO of pooled buffers which is concurrently flushed by
the current thread.
It performs best when used with unbuffered streams.
- Parameters:
source - the source for reading the data from.sink - the sink for writing the data to.
- Throws:
InputException - if copying the data fails because of an
IOException thrown by the input stream.
IOException - if copying the data fails because of an
IOException thrown by the output stream.
Copyright © 2013 Schlichtherle IT Services. All rights reserved.