public class ODFStreamWriter
extends java.io.Writer
Modifier and Type | Field and Description |
---|---|
protected ODFEntry |
contentEntry
Keep the entry for content writer.
|
protected java.io.CharArrayWriter |
contentWriter
An internal writer for specified content entry.
|
protected java.util.zip.ZipOutputStream |
zipOutputStream
An internal output stream for ZIP file.
|
Constructor and Description |
---|
ODFStreamWriter(java.io.OutputStream out)
Create an ODFStreamWriter with default charset.
|
ODFStreamWriter(java.io.OutputStream out,
java.lang.String entryName)
Create an ODFStreamWriter by specified entry name.
|
ODFStreamWriter(java.io.OutputStream out,
java.lang.String entryName,
java.lang.String charsetName)
Create an ODFStreamWriter by specified entry name and charset.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the stream.
|
void |
closeEntry()
Closes the current ODF entry and positions the stream for writing the next entry.
|
protected void |
ensureOpen()
Check to make sure that the stream has not been closed.
|
void |
flush()
Flushes the stream.
|
ODFEntry |
getContentEntry()
Returns the ODF file entry for the writer, or null if not found.
|
java.io.OutputStream |
getOutputStream()
Returns an output stream for this writer.
|
void |
init(java.lang.String entryName)
Initialize ODF stream.
|
void |
putNextEntry(ODFEntry entry)
Begins writing a new ODF entry and positions the stream to the start of the entry data.
|
void |
write(byte[] buf,
int offset,
int length)
Writes an array of bytes to the current ODF entry data.
|
void |
write(char[] cbuf,
int offset,
int length)
Write characters to content.xml into a stream.
|
protected java.util.zip.ZipOutputStream zipOutputStream
protected java.io.CharArrayWriter contentWriter
protected ODFEntry contentEntry
public ODFStreamWriter(java.io.OutputStream out) throws java.io.IOException
out
- An OutputStreamjava.io.IOException
- if an I/O error has occurredpublic ODFStreamWriter(java.io.OutputStream out, java.lang.String entryName) throws java.io.IOException
out
- An OutputStreamentryName
- target entry namejava.util.zip.ZipException
- if a ZIP file error has occurredjava.io.IOException
- if an I/O error has occurredpublic ODFStreamWriter(java.io.OutputStream out, java.lang.String entryName, java.lang.String charsetName) throws java.io.IOException
out
- An OutputStreamentryName
- target entry namecharsetName
- The name of a supported java.nio.charset.Charset
charset
java.util.zip.ZipException
- if a ZIP file error has occurredjava.io.IOException
- if an I/O error has occurredpublic void init(java.lang.String entryName) throws java.io.IOException
entryName
- name of target reading entry.java.io.IOException
- If an I/O error occurspublic ODFEntry getContentEntry()
protected void ensureOpen() throws java.io.IOException
java.io.IOException
- If stream has been closedpublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Writer
java.io.IOException
- If an I/O error occurspublic void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.Writer
java.io.IOException
- If an I/O error occurspublic void write(char[] cbuf, int offset, int length) throws java.io.IOException
write
in class java.io.Writer
cbuf
- Array of charactersoffset
- Offset from which to start writing characterslength
- Number of characters to writejava.io.IOException
- If an I/O error occurspublic java.io.OutputStream getOutputStream() throws java.io.IOException
java.io.IOException
- if an I/O error has occurredpublic void putNextEntry(ODFEntry entry) throws java.io.IOException
entry
- the ODF entry to be writtenjava.io.IOException
- if an I/O error has occurredpublic void closeEntry() throws java.io.IOException
java.io.IOException
- if an I/O error has occurredpublic void write(byte[] buf, int offset, int length) throws java.io.IOException
buf
- the data to be writtenoffset
- the start offset in the datalength
- the number of bytes that are writtenjava.io.IOException
- if an I/O error has occurredCopyright © 2010 - No Magic Asia