|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.OutputStream java.io.FilterOutputStream java.io.BufferedOutputStream net.sf.basedb.core.File.UploadStream
private class File.UploadStream
This class is used for uploading a file. It keeps track of the number of bytes uploaded and sets the size accordingly.
File.getUploadStream(boolean)
Field Summary | |
---|---|
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. |
Fields inherited from class java.io.BufferedOutputStream |
---|
buf, count |
Fields inherited from class java.io.FilterOutputStream |
---|
out |
Constructor Summary | |
---|---|
private |
File.UploadStream(File file,
boolean calculateMd5,
boolean checkMd5,
boolean compress)
Create a new UploadStream and connect it to the
given file. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.io.BufferedOutputStream |
---|
flush |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private boolean closed
private long totalBytes
private MessageDigest md5
private File file
private boolean compress
private boolean checkMd5
Constructor Detail |
---|
private File.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 properly
IOException
- If there is an error during the uploadMethod Detail |
---|
public 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 class FilterOutputStream
IOException
- if an I/O error occurs.
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |