public class DurboOutput extends 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(OutputStream out)
Creates a new
DurboOutput that uses the given output stream. |
DurboOutput(OutputStream out,
double version)
Creates a new
DurboOutput that uses the given output stream. |
DurboOutput(OutputStream out,
DurboNamespaceResolver resolver)
Creates a new
DurboOutput that uses the given output stream. |
DurboOutput(OutputStream out,
DurboNamespaceResolver resolver,
double version)
Creates a new
DurboOutput that uses the given output stream. |
DurboOutput(OutputStream out,
DurboNamespaceResolver resolver,
String contentType,
boolean compressed)
Creates a new
DurboOutput that uses the given output stream. |
DurboOutput(OutputStream out,
DurboNamespaceResolver resolver,
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(String prefix,
String uri)
writes a namespace definition to the stream.
|
void |
openNode(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(String name,
byte[] data)
Writes a binary property with the given
name and data to the output. |
void |
writeProperty(String name,
InputStream in)
Write a binary property with the given
name and data provided in
the input stream to to the output. |
void |
writeProperty(String name,
InputStream in,
int size)
Write a property with the given
name and data provided in
the input stream to to the output. |
void |
writeProperty(String name,
int type,
String value)
Writes a typed single value property.
|
void |
writeProperty(String name,
int type,
String[] values)
Writes a typed multivalue property.
|
void |
writeProperty(String name,
String data)
Writes a string property with the given
name and data
to the output. |
public DurboOutput(OutputStream out) throws 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 streamIOException
- if an error occurspublic DurboOutput(OutputStream out, double version) throws 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
IOException
- if an error occurspublic DurboOutput(OutputStream out, DurboNamespaceResolver resolver) throws IOException
DurboOutput
that uses the given output stream.
this also writes the protocol header.out
- the output streamresolver
- the namespace resolverIOException
- if an error occurspublic DurboOutput(OutputStream out, DurboNamespaceResolver resolver, double version) throws 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
IOException
- if an error occurspublic DurboOutput(OutputStream out, DurboNamespaceResolver resolver, String contentType, boolean compressed) throws 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.IOException
- if an error occurspublic DurboOutput(OutputStream out, DurboNamespaceResolver resolver, String contentType, boolean compressed, double version) throws 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
IOException
- if an error occurspublic void close() throws IOException
IOException
- if an I/O error occurspublic void defineNamespace(String prefix, String uri) throws IOException
prefix
- the namespace prefixuri
- the namespace uriIOException
- if an I/O exception occurspublic void writeProperty(String name, byte[] data) throws IOException
name
and data
to the output.name
- the name of the propertydata
- the data to write to the streamIOException
- if an error occurspublic void writeProperty(String name, String data) throws IOException
name
and data
to the output.name
- the name of the propertydata
- the data to write to the streamIOException
- if an error occurspublic void writeProperty(Property prop) throws IOException, RepositoryException
prop
- the property to writeIOException
- if an I/O error occursRepositoryException
- if an error occurspublic void writeProperty(String name, int type, String[] values) throws IOException
name
- name of the propertytype
- type of the propertyvalues
- values of the propertyIOException
- if an I/O error occurspublic void writeProperty(String name, int type, String value) throws IOException
name
- name of the propertytype
- type of the propertyvalue
- value of the propertyIOException
- if an I/O error occurspublic void writeProperty(String name, InputStream in) throws 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 streamIOException
- if an error occurspublic void writeProperty(String name, InputStream in, int size) throws 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.IOException
- if an error occurspublic void openNode(String name) throws IOException
name
.name
- the name of the nodeIOException
- if an error occurspublic void closeNode() throws IOException
IOException
- if an error occurs"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"