it.could.webdav
Class DAVOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byit.could.webdav.DAVOutputStream

public class DAVOutputStream
extends OutputStream

A specialized OutputStream to write to DAVResources.

When writing to this OutputStream the data will be written to a temporary file. This temporary file will be moved to its final destination (the original file identifying the resource) when the close() method is called.

This specialized OutputStream never throws IOExceptions, but rather relies on the unchecked DAVException to notify the framework of the correct DAV errors.

Author:
Pier Fumagalli

Constructor Summary
protected DAVOutputStream(DAVResource resource)
          Create a new DAVOutputStream instance.
 
Method Summary
 void abort()
          Abort any data written to the temporary file and delete it.
 void close()
          Close this OutputStream renaming the temporary file to the original one.
 void finalize()
          Finalize this DAVOutputStream instance.
 void flush()
          Flush any unwritten data to the disk.
protected  void rename(File temporary, File original)
          Rename the temporary File to the original one.
 void write(byte[] b)
          Write data to this OutputStream.
 void write(byte[] b, int o, int l)
          Write data to this OutputStream.
 void write(int b)
          Write data to this OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DAVOutputStream

protected DAVOutputStream(DAVResource resource)

Create a new DAVOutputStream instance.

Method Detail

rename

protected void rename(File temporary,
                      File original)
               throws IOException

Rename the temporary File to the original one.

Throws:
IOException

abort

public void abort()

Abort any data written to the temporary file and delete it.


close

public void close()

Close this OutputStream renaming the temporary file to the original one.


flush

public void flush()

Flush any unwritten data to the disk.


write

public void write(int b)

Write data to this OutputStream.


write

public void write(byte[] b)

Write data to this OutputStream.


write

public void write(byte[] b,
                  int o,
                  int l)

Write data to this OutputStream.


finalize

public void finalize()

Finalize this DAVOutputStream instance.