private class File.UploadStream extends BufferedOutputStream
File.getUploadStream(boolean)
Modifier and Type | Field and Description |
---|---|
private boolean |
checkMd5
If the md5 should be checked or not.
|
private boolean |
closed
If this file closed or not.
|
private boolean |
compress
If the file should be compressed or not.
|
private File |
file
The file to write to.
|
private MessageDigest |
md5
The md5 sum calculater.
|
private long |
totalBytes
Number of bytes written to the stream.
|
buf, count
out
Modifier | Constructor and Description |
---|---|
private |
UploadStream(File file,
boolean calculateMd5,
boolean checkMd5,
boolean compress)
Create a new
UploadStream and connect it to the
given file. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the stream and register the size and location with the file item.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b)
Writes the specified byte to this buffered output stream.
|
flush
private boolean closed
private long totalBytes
private MessageDigest md5
private File file
private boolean compress
private boolean checkMd5
private UploadStream(File file, boolean calculateMd5, boolean checkMd5, boolean compress) throws IOException
UploadStream
and connect it to the
given file.file
- The physical file path to which the stream will writecalculateMd5
- TRUE if an md5 sum should be calculated from this uploadstreamcheckMd5
- If the md5 sum of the file should be checked agains the
previously stored md5 sum, useful for making sure secondary storage is
working properlyIOException
- If there is an error during the uploadpublic void write(byte[] b, int off, int len) throws IOException
write
in class BufferedOutputStream
IOException
public void write(byte[] b) throws IOException
write
in class FilterOutputStream
IOException
public void write(int b) throws IOException
write
in class BufferedOutputStream
b
- the byte to be written.IOException
- if an I/O error occurs.BufferedOutputStream.write(int)
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterOutputStream
IOException
- if an I/O error occurs.