private class File.UploadStream
extends java.io.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 java.io.File |
file
The file to write to.
|
private java.security.MessageDigest |
md5
The md5 sum calculater.
|
private long |
totalBytes
Number of bytes written to the stream.
|
Modifier | Constructor and Description |
---|---|
private |
UploadStream(java.io.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.
|
private boolean closed
private long totalBytes
private java.security.MessageDigest md5
private java.io.File file
private boolean compress
private boolean checkMd5
private UploadStream(java.io.File file, boolean calculateMd5, boolean checkMd5, boolean compress) throws java.io.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 properlyjava.io.IOException
- If there is an error during the uploadpublic void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.BufferedOutputStream
java.io.IOException
public void write(byte[] b) throws java.io.IOException
write
in class java.io.FilterOutputStream
java.io.IOException
public void write(int b) throws java.io.IOException
write
in class java.io.BufferedOutputStream
b
- the byte to be written.java.io.IOException
- if an I/O error occurs.BufferedOutputStream.write(int)
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.FilterOutputStream
java.io.IOException
- if an I/O error occurs.