public class AppendOutputStream extends OutputStream
flush()
is called, or close() is called. Because sending data to the
repository requires a HTTP call, this should be triggered only when
necessary. Depending on the use case, the buffer size should be increased.
If the overwrite mode is enabled, the first call is a setContentStream()
call, which overwrites the existing content. All following calls are
appendContentStream() calls. If the overwrite mode is not enabled, all calls
are appendContentStream() calls.
If the document is versioned, it's the responsibility of the caller to check
it out and check it in. If the document is auto-versioned, each chunk of
bytes may create a new version.
If the repository supports change tokens and the provided document has a
non-empty change token property (cmis:changeToken), change tokens are
respected.
This class is not thread safe.| Modifier and Type | Field and Description |
|---|---|
static OperationContext |
DOCUMENT_OPERATION_CONTEXT |
| Constructor and Description |
|---|
AppendOutputStream(Session session,
Document doc,
boolean overwrite,
String filename,
String mimeType) |
AppendOutputStream(Session session,
Document doc,
boolean overwrite,
String filename,
String mimeType,
int bufferSize)
Creates an OutputStream that appends content to a document.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
close(boolean isLastChunk)
Closes the stream.
|
void |
flush() |
void |
flush(boolean isLastChunk)
Appends (or sets) the current buffer to the document.
|
protected void |
send(boolean isLastChunk)
Updates the document content with the provided content stream.
|
protected void |
send(byte[] extraBytes,
int extraOff,
int extraLen,
boolean isLastChunk)
Updates the document content with the provided content stream.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public static final OperationContext DOCUMENT_OPERATION_CONTEXT
public AppendOutputStream(Session session, Document doc, boolean overwrite, String filename, String mimeType)
public AppendOutputStream(Session session, Document doc, boolean overwrite, String filename, String mimeType, int bufferSize)
session - the session object, must not be nulldoc - the document, must not be nulloverwrite - if true the first call to repository sets a new
content, if false the all calls append to the current
contentfilename - the file name, may be nullmimeType - the MIME type, may be nullbufferSize - buffer sizepublic void write(int b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void flush(boolean isLastChunk)
throws IOException
isLastChunk - indicates if this is the last chunk of the contentIOException - if an error occursprotected void send(boolean isLastChunk)
throws IOException
IOExceptionprotected void send(byte[] extraBytes,
int extraOff,
int extraLen,
boolean isLastChunk)
throws IOException
IOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic void close(boolean isLastChunk)
throws IOException
isLastChunk - indicates if this is the last chunk of the contentIOException - if an error occursCopyright © 2009–2017 The Apache Software Foundation. All rights reserved.