org.duracloud.client.util
Class DuracloudFileWriter

java.lang.Object
  extended by java.io.Writer
      extended by org.duracloud.client.util.DuracloudFileWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable

public class DuracloudFileWriter
extends Writer

This class encapsulates writing a simple text file and saving it as a content item.

Author:
Danny Bernstein Date: Jan 4, 2011

Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
DuracloudFileWriter(String spaceId, String contentId, String mimetype, ContentStore contentStore)
           
 
Method Summary
 void close()
           
protected  void finalize()
           
 void flush()
          Writes the tempfile to durastore.
 void write(char[] cbuf, int off, int len)
           
 void write(String line)
           
 void writeLine(String line)
          Same as write but appends a new line to the end of the supplied line.
 
Methods inherited from class java.io.Writer
append, append, append, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DuracloudFileWriter

public DuracloudFileWriter(String spaceId,
                           String contentId,
                           String mimetype,
                           ContentStore contentStore)
                    throws org.duracloud.common.error.DuraCloudRuntimeException
Parameters:
spaceId - of the space in which you would like to persist the text.
contentId - of the item you would like to store the text in.
contentStore - to which you would like write the stream.
Throws:
org.duracloud.common.error.DuraCloudRuntimeException
Method Detail

flush

public void flush()
           throws IOException
Writes the tempfile to durastore.

Specified by:
flush in interface Flushable
Specified by:
flush in class Writer
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Specified by:
close in class Writer
Throws:
IOException

writeLine

public void writeLine(String line)
               throws IOException
Same as write but appends a new line to the end of the supplied line.

Parameters:
line -
Throws:
org.duracloud.common.error.DuraCloudRuntimeException
IOException

write

public void write(String line)
           throws IOException
Overrides:
write in class Writer
Throws:
IOException

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws IOException
Specified by:
write in class Writer
Throws:
IOException


Copyright © 2009-2012 DuraSpace. All Rights Reserved.