public class StreamToFileCopier extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
StreamToFileCopier.ProgressPublisher |
static interface |
StreamToFileCopier.StreamToFileCopierListener |
| Modifier and Type | Method and Description |
|---|---|
void |
copy(InputStream sourceStream,
File destinationFile)
Copies data from stream to file.
|
void |
copyAsync(InputStream sourceStream,
File destinationFile)
Copies data from stream to file in a background thread,
result is returned in UIthread to listener provided during object creation.
|
static String |
generateHash()
Generates random 8-bit alphanumeric string.
|
static StreamToFileCopier |
getAsyncFileCopier(StreamToFileCopier.StreamToFileCopierListener listener)
Creates object for synchronize copy with given parameters
|
static StreamToFileCopier |
getSyncFileCopier(StreamToFileCopier.ProgressPublisher publisher,
long dataSize)
Creates object for synchronize copy with given parameters
|
public static StreamToFileCopier getAsyncFileCopier(StreamToFileCopier.StreamToFileCopierListener listener)
listener - will be notify when copying is donepublic static StreamToFileCopier getSyncFileCopier(StreamToFileCopier.ProgressPublisher publisher, long dataSize)
publisher - will get updates with copy progressdataSize - public void copyAsync(InputStream sourceStream, File destinationFile)
sourceStream - A stream to copy from.destinationFile - A file to copy to.public void copy(InputStream sourceStream, File destinationFile) throws Exception
sourceStream - A stream to copy from.destinationFile - A file to copy to.Exceptionpublic static String generateHash()