Package org.duracloud.client.util
Class DuracloudFileWriter
- java.lang.Object
-
- java.io.Writer
-
- org.duracloud.client.util.DuracloudFileWriter
-
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
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
-
-
Constructor Summary
Constructors Constructor Description DuracloudFileWriter(String spaceId, String contentId, String mimetype, ContentStore contentStore)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected voidfinalize()voidflush()Writes the tempfile to durastore.voidwrite(char[] cbuf, int off, int len)voidwrite(String line)voidwriteLine(String line)Same as write but appends a new line to the end of the supplied line.
-
-
-
Constructor Detail
-
DuracloudFileWriter
public DuracloudFileWriter(String spaceId, String contentId, String mimetype, ContentStore contentStore) throws 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:
DuraCloudRuntimeException
-
-
Method Detail
-
flush
public void flush() throws IOExceptionWrites the tempfile to durastore.- Specified by:
flushin interfaceFlushable- Specified by:
flushin classWriter- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- 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:
DuraCloudRuntimeExceptionIOException
-
write
public void write(String line) throws IOException
- Overrides:
writein classWriter- Throws:
IOException
-
finalize
protected void finalize() throws Throwable
-
write
public void write(char[] cbuf, int off, int len) throws IOException- Specified by:
writein classWriter- Throws:
IOException
-
-