Package org.apache.juneau.serializer
Class OutputStreamSerializer
java.lang.Object
org.apache.juneau.Context
org.apache.juneau.BeanContextable
org.apache.juneau.BeanTraverseContext
org.apache.juneau.serializer.Serializer
org.apache.juneau.serializer.OutputStreamSerializer
- All Implemented Interfaces:
AnnotationProvider
- Direct Known Subclasses:
ImageSerializer
,MsgPackSerializer
Subclass of
Serializer
for byte-based serializers.
Notes:
- This class is thread safe and reusable.
See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.juneau.serializer.Serializer
Serializer.Null
-
Field Summary
Fields inherited from class org.apache.juneau.Context
CONTEXT_APPLY_FILTER
Fields inherited from interface org.apache.juneau.AnnotationProvider
DEFAULT, DISABLE_ANNOTATION_CACHING
-
Constructor Summary
ModifierConstructorDescriptionprotected
Constructor. -
Method Summary
Modifier and TypeMethodDescriptioncreate()
Creates a new builder for this object.Create a session builder based on the properties defined on this context.protected final BinaryFormat
Binary output format.Returns a session to use for this context.final boolean
Returnstrue if this serializer subclasses fromWriterSerializer
.protected JsonMap
Returns the properties on this bean as a map for debugging.final byte[]
Convenience method for serializing an object to a
.byte Methods inherited from class org.apache.juneau.serializer.Serializer
copy, createSerializerBuilder, doSerialize, forEachAcceptMediaType, getListener, getMediaTypeRanges, getPrimaryMediaType, getResponseContentType, getResponseHeaders, getUriContext, getUriRelativity, getUriResolution, isAddBeanTypes, isAddRootType, isKeepNullProperties, isSortCollections, isSortMaps, isTrimEmptyCollections, isTrimEmptyMaps, isTrimStrings, serialize, serializeToString
Methods inherited from class org.apache.juneau.BeanTraverseContext
getInitialDepth, getMaxDepth, isDetectRecursions, isIgnoreRecursions
Methods inherited from class org.apache.juneau.BeanContextable
getBeanContext
Methods inherited from class org.apache.juneau.Context
createBuilder, firstAnnotation, firstAnnotation, firstAnnotation, firstAnnotation, firstDeclaredAnnotation, forEachAnnotation, forEachAnnotation, forEachAnnotation, forEachAnnotation, forEachDeclaredAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, hasAnnotation, init, isDebug, lastAnnotation, lastAnnotation, lastAnnotation, lastAnnotation, lastDeclaredAnnotation, toString
-
Constructor Details
-
OutputStreamSerializer
Constructor.- Parameters:
builder
- The builder for this object.
-
-
Method Details
-
create
Creates a new builder for this object.- Returns:
- A new builder.
-
createSession
Description copied from class:Context
Create a session builder based on the properties defined on this context.Use this method for creating sessions where you want to override basic settings. Otherwise, use
Context.getSession()
directly.- Overrides:
createSession
in classSerializer
- Returns:
- A new session builder.
-
getSession
Description copied from class:Context
Returns a session to use for this context.Note that subclasses may opt to return a reusable non-modifiable session.
- Overrides:
getSession
in classSerializer
- Returns:
- A new session object.
-
isWriterSerializer
Description copied from class:Serializer
Returnstrue if this serializer subclasses fromWriterSerializer
.- Overrides:
isWriterSerializer
in classSerializer
- Returns:
true if this serializer subclasses fromWriterSerializer
.
-
serialize
Convenience method for serializing an object to a
.byte - Overrides:
serialize
in classSerializer
- Parameters:
o
- The object to serialize.- Returns:
- The output serialized to a byte array.
- Throws:
SerializeException
- If a problem occurred trying to convert the output.
-
getBinaryFormat
Binary output format.- Returns:
- The format to use for the
Serializer.serializeToString(Object)
method on stream-based serializers when converting byte arrays to strings. - See Also:
-
properties
Description copied from class:Context
Returns the properties on this bean as a map for debugging.- Overrides:
properties
in classSerializer
- Returns:
- The properties on this bean as a map for debugging.
-