|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
java.io.FileOutputStream
org.apache.excalibur.source.impl.HTTPClientSource.WrappedFileOutputStream
private class HTTPClientSource.WrappedFileOutputStream
Internal class which extends FileOutputStream to
automatically upload the data written to it, upon a close()
operation.
| Field Summary | |
|---|---|
private java.io.File |
m_file
Reference to the File being written itself. |
private org.apache.avalon.framework.logger.Logger |
m_logger
Reference to a Logger. |
| Constructor Summary | |
|---|---|
HTTPClientSource.WrappedFileOutputStream(java.io.File file,
org.apache.avalon.framework.logger.Logger logger)
Constructor, creates a new HTTPClientSource.WrappedFileOutputStream
instance. |
|
| Method Summary | |
|---|---|
boolean |
canCancel()
Method to test whether this stream can be closed. |
void |
cancel()
Cancels this stream. |
void |
close()
Closes the stream, and uploads the file written to the server. |
private boolean |
successfulUpload(int response)
According to RFC2616 (HTTP 1.1) valid responses for a HTTP PUT are 201 (Created), 200 (OK), and 204 (No Content). |
private void |
upload()
Helper method to attempt uploading of the local data file to the remove server via a HTTP PUT. |
| Methods inherited from class java.io.FileOutputStream |
|---|
finalize, getChannel, getFD, write, write, write |
| Methods inherited from class java.io.OutputStream |
|---|
flush |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.io.File m_file
private final org.apache.avalon.framework.logger.Logger m_logger
Logger.
| Constructor Detail |
|---|
public HTTPClientSource.WrappedFileOutputStream(java.io.File file,
org.apache.avalon.framework.logger.Logger logger)
throws java.io.IOException
HTTPClientSource.WrappedFileOutputStream
instance.
file - File to write to.logger - Logger reference.
java.io.IOException - if an error occurs| Method Detail |
|---|
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.FileOutputStreamjava.io.IOException - if an error occurspublic boolean canCancel()
true if possible, false otherwise.
public void cancel()
throws java.io.IOException
java.io.IOException - if stream is already closed
private void upload()
throws java.io.IOException
java.io.IOException - if an error occursprivate boolean successfulUpload(int response)
response - response code from the HTTP PUT
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||