public class DurboOutput extends java.lang.Object implements DurboConstants
PropertyType
s from jsr170.
the additional (invisible) element 'namespace' is used to sequentially define
namespaces that will be used in the subsequent elements.
since version 2.1 the deflater of the output stream is reset about every 2^12
bytes (1mb). this generates a output stream that consists of several
compressed chunks. this means that a possible reader must be prepared for
resetting it's inflater as well. see ChunkedDeflaterOutputStream
and
ChunkedInflaterInputStream
for details. this has only an advantage
during deserialization when large binary properties are kept in
DurboValue
s and needed to be read from the consumer.
Version 2.0 introduced:
DurboConstants.PROTOCOL_HEADER
hdrContentType := svProp; // with name DurboConstants.PROTOCOL_CONTENT_TYPE
hdrEncoding := svProp; // with name DurboConstants.PROTOCOL_ENCODING
elem:= node | prop | namespace;
node:= NODE_START name elemlist NODE_END;
prop:= svProp | mvProp;
svProp:= PROPERTY|type name value;
mvProp:= PROPERTY|MULTIPLE|type name <# values> {value};
namespace:= NAMESPACE prefix uri;
prefix:= sValue;
uri := sValue;
name:= sValue;
value:= sValue | bValue;
sValue:= DurboConstants.NODE_START
;
NODE_END:= DurboConstants.NODE_END
;
PROPERTY:= DurboConstants.PROPERTY
;
MULTIPLE:= DurboConstants.MULTIPLE
;
NAMESPACE:= DurboConstants.NAMESPACE
;
DEFAULT_CONTENT_TYPE, MULTIPLE, NAMESPACE, NODE_END, NODE_START, PROPERTY, PROPERTY_TYPE_MASK, PROTOCOL_CONTENT_TYPE, PROTOCOL_ENCODING, PROTOCOL_HEADER, PROTOCOL_VERSION, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, PROTOCOL_VERSION_2_1
Constructor and Description |
---|
DurboOutput(java.io.OutputStream out)
Creates a new
DurboOutput that uses the given output stream. |
DurboOutput(java.io.OutputStream out,
double version)
Creates a new
DurboOutput that uses the given output stream. |
DurboOutput(java.io.OutputStream out,
DurboNamespaceResolver resolver)
Creates a new
DurboOutput that uses the given output stream. |
DurboOutput(java.io.OutputStream out,
DurboNamespaceResolver resolver,
double version)
Creates a new
DurboOutput that uses the given output stream. |
DurboOutput(java.io.OutputStream out,
DurboNamespaceResolver resolver,
java.lang.String contentType,
boolean compressed)
Creates a new
DurboOutput that uses the given output stream. |
DurboOutput(java.io.OutputStream out,
DurboNamespaceResolver resolver,
java.lang.String contentType,
boolean compressed,
double version)
Creates a new
DurboOutput that uses the given output stream. |
Modifier and Type | Method and Description |
---|---|
void |
close()
closes the output.
|
void |
closeNode()
Writes an closing node marker to the output.
|
void |
defineNamespace(java.lang.String prefix,
java.lang.String uri)
writes a namespace definition to the stream.
|
void |
openNode(java.lang.String name)
Writes an open node marker to the output with the given node
name . |
void |
writeProperty(Property prop)
Writes a JCR property to the output
|
void |
writeProperty(java.lang.String name,
byte[] data)
Writes a binary property with the given
name and data to the output. |
void |
writeProperty(java.lang.String name,
java.io.InputStream in)
Write a binary property with the given
name and data provided in
the input stream to to the output. |
void |
writeProperty(java.lang.String name,
java.io.InputStream in,
int size)
Write a property with the given
name and data provided in
the input stream to to the output. |
void |
writeProperty(java.lang.String name,
int type,
java.lang.String value)
Writes a typed single value property.
|
void |
writeProperty(java.lang.String name,
int type,
java.lang.String[] values)
Writes a typed multivalue property.
|
void |
writeProperty(java.lang.String name,
java.lang.String data)
Writes a string property with the given
name and data
to the output. |
public DurboOutput(java.io.OutputStream out) throws java.io.IOException
DurboOutput
that uses the given output stream.
this also writes the protocol header.
please note that the protocol version is set to DurboConstants.PROTOCOL_VERSION_1
which is probably what you want.
please note that this uses the IdentityNamespaceResolver
and can
therefor generate weird results upon deserialization.out
- the output streamjava.io.IOException
- if an error occurspublic DurboOutput(java.io.OutputStream out, double version) throws java.io.IOException
DurboOutput
that uses the given output stream.
this also writes the protocol header.
please note that this uses the IdentityNamespaceResolver
and can
therefor generate weird results upon deserialization.out
- the output streamversion
- the protocol version to use. default is
DurboConstants.PROTOCOL_VERSION
java.io.IOException
- if an error occurspublic DurboOutput(java.io.OutputStream out, DurboNamespaceResolver resolver) throws java.io.IOException
DurboOutput
that uses the given output stream.
this also writes the protocol header.out
- the output streamresolver
- the namespace resolverjava.io.IOException
- if an error occurspublic DurboOutput(java.io.OutputStream out, DurboNamespaceResolver resolver, double version) throws java.io.IOException
DurboOutput
that uses the given output stream.
this also writes the protocol header.out
- the output streamresolver
- the namespace resolverversion
- the protocol version to use. default is
DurboConstants.PROTOCOL_VERSION
java.io.IOException
- if an error occurspublic DurboOutput(java.io.OutputStream out, DurboNamespaceResolver resolver, java.lang.String contentType, boolean compressed) throws java.io.IOException
DurboOutput
that uses the given output stream.
this also writes the protocol header.out
- the output streamresolver
- the namespace resolvercontentType
- the content type to include in the header. default is
DurboConstants.DEFAULT_CONTENT_TYPE
compressed
- if true
output stream will be compressed.java.io.IOException
- if an error occurspublic DurboOutput(java.io.OutputStream out, DurboNamespaceResolver resolver, java.lang.String contentType, boolean compressed, double version) throws java.io.IOException
DurboOutput
that uses the given output stream.
this also writes the protocol header.out
- the output streamresolver
- the namespace resolvercontentType
- the content type to include in the header. default is
DurboConstants.DEFAULT_CONTENT_TYPE
compressed
- if true
output stream will be compressed.version
- the protocol version to use. default is
DurboConstants.PROTOCOL_VERSION
java.io.IOException
- if an error occurspublic void close() throws java.io.IOException
java.io.IOException
- if an I/O error occurspublic void defineNamespace(java.lang.String prefix, java.lang.String uri) throws java.io.IOException
prefix
- the namespace prefixuri
- the namespace urijava.io.IOException
- if an I/O exception occurspublic void writeProperty(java.lang.String name, byte[] data) throws java.io.IOException
name
and data
to the output.name
- the name of the propertydata
- the data to write to the streamjava.io.IOException
- if an error occurspublic void writeProperty(java.lang.String name, java.lang.String data) throws java.io.IOException
name
and data
to the output.name
- the name of the propertydata
- the data to write to the streamjava.io.IOException
- if an error occurspublic void writeProperty(Property prop) throws java.io.IOException, RepositoryException
prop
- the property to writejava.io.IOException
- if an I/O error occursRepositoryException
- if an error occurspublic void writeProperty(java.lang.String name, int type, java.lang.String[] values) throws java.io.IOException
name
- name of the propertytype
- type of the propertyvalues
- values of the propertyjava.io.IOException
- if an I/O error occurspublic void writeProperty(java.lang.String name, int type, java.lang.String value) throws java.io.IOException
name
- name of the propertytype
- type of the propertyvalue
- value of the propertyjava.io.IOException
- if an I/O error occurspublic void writeProperty(java.lang.String name, java.io.InputStream in) throws java.io.IOException
name
and data provided in
the input stream to to the output.name
- the name of the propertyin
- the data to write to the streamjava.io.IOException
- if an error occurspublic void writeProperty(java.lang.String name, java.io.InputStream in, int size) throws java.io.IOException
name
and data provided in
the input stream to to the output.name
- the name of the propertyin
- the data to write to the streamsize
- The number of bytes to write from the InputStream
.
If this value is negative, as much is read from the input stream
as possible.java.io.IOException
- if an error occurspublic void openNode(java.lang.String name) throws java.io.IOException
name
.name
- the name of the nodejava.io.IOException
- if an error occurspublic void closeNode() throws java.io.IOException
java.io.IOException
- if an error occurs"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"