public abstract class OutputStreamSerializerSession extends SerializerSession
SerializerSession
for stream-based serializers.
indent
Modifier | Constructor and Description |
---|---|
protected |
OutputStreamSerializerSession(OutputStreamSerializer ctx,
SerializerSessionArgs args)
Create a new session using properties specified in the context.
|
protected |
OutputStreamSerializerSession(SerializerSessionArgs args)
Constructor for sessions that don't require context.
|
Modifier and Type | Method and Description |
---|---|
protected SerializerPipe |
createPipe(Object output)
Wraps the specified input object into a
ParserPipe object so that it can be easily converted into
a stream or reader. |
protected BinaryFormat |
getBinaryFormat()
Configuration property: Binary output format.
|
boolean |
isWriterSerializer()
Returns
WriterSerializer . |
byte[] |
serialize(Object o)
Convenience method for serializing an object to a
. |
String |
serializeToString(Object o)
Shortcut method for serializing an object to a String.
|
ObjectMap |
toMap()
Returns the properties defined on this bean context as a simple map for debugging purposes.
|
canIgnoreValue, createBeanTypeNameProperty, createDefaultVarResolverSession, doSerialize, generalize, getBeanTypeName, getExpectedRootType, getJavaMethod, getListener, getListener, getResponseHeaders, getUriContext, getUriRelativity, getUriResolution, getUriResolver, getVarResolver, isAddBeanTypes, isAddRootType, isSortCollections, isSortMaps, isTrimEmptyCollections, isTrimEmptyMaps, isTrimNullProperties, isTrimStrings, onBeanGetterException, onError, push2, relativizeUri, resolve, resolveUri, serialize, sort, sort, swap, toList, toString, trim, varSessionObject
getInitialDepth, getLastLocation, getMaxDepth, getOptionalType, getOptionalValue, getStack, isDetectRecursions, isIgnoreRecursions, isOptional, pop, push, setCurrentClass, setCurrentProperty, willRecurse
_class, checkForWarnings, convertToMemberType, convertToMemberType, convertToType, convertToType, convertToType, getArgsClassMeta, getBeanClassVisibility, getBeanConstructorVisibility, getBeanDictionaryClasses, getBeanFieldVisibility, getBeanFilters, getBeanMeta, getBeanMethodVisibility, getBeanRegistry, getBeanTypePropertyName, getBeanTypePropertyName, getBpi, getBpro, getBpwo, getBpx, getClassMeta, getClassMeta, getClassMetaForObject, getClassMetaForObject, getExamples, getImplClasses, getLocale, getMediaType, getNotBeanClasses, getNotBeanPackagesNames, getNotBeanPackagesPrefixes, getPojoSwaps, getPropertyNamer, getSchema, getStringBuilder, getTimeZone, getTimeZoneId, isBean, isBean, isBeanMapPutReturnsOldValue, isBeansRequireDefaultConstructor, isBeansRequireSerializable, isBeansRequireSettersForGetters, isBeansRequireSomeProperties, isDebug, isFluentSetters, isIgnoreInvocationExceptionsOnGetters, isIgnoreInvocationExceptionsOnSetters, isIgnorePropertiesWithoutSetters, isIgnoreUnknownBeanProperties, isIgnoreUnknownNullBeanProperties, isSortProperties, isUseEnumNames, isUseInterfaceProxies, isUseJavaBeanIntrospector, newBean, newBean, newBeanMap, newBeanMap, object, returnStringBuilder, string, toArray, toBeanMap, toBeanMap
addToCache, addToCache, addWarning, getClassProperty, getFromCache, getInstanceArrayProperty, getInstanceProperty, getLogger, getProperties, getProperty, getProperty, getProperty, getPropertyKeys, getWarnings, hasProperty, hasWarnings, toString
protected OutputStreamSerializerSession(OutputStreamSerializer ctx, SerializerSessionArgs args)
ctx
- The context creating this session object.
The context contains all the configuration settings for this object.args
- Runtime arguments.
These specify session-level information such as locale and URI context.
It also include session-level properties that override the properties defined on the bean and
serializer contexts.protected OutputStreamSerializerSession(SerializerSessionArgs args)
args
- Runtime session arguments.public final boolean isWriterSerializer()
SerializerSession
WriterSerializer
.isWriterSerializer
in class SerializerSession
WriterSerializer
.protected SerializerPipe createPipe(Object output)
SerializerSession
ParserPipe
object so that it can be easily converted into
a stream or reader.createPipe
in class SerializerSession
output
- The output location.
Writer
OutputStream
- Output will be written as UTF-8 encoded stream.
File
- Output will be written as system-default encoded stream.
StringBuilder
ParserPipe
wrapper around the specified input object.public final byte[] serialize(Object o) throws SerializeException
byte
.serialize
in class SerializerSession
o
- The object to serialize.SerializeException
- If a problem occurred trying to convert the output.public final String serializeToString(Object o) throws SerializeException
SerializerSession
serializeToString
in class SerializerSession
o
- The object to serialize.byte []
converted to a string based on the OutputStreamSerializer.OSSERIALIZER_binaryFormat
setting.SerializeException
- If a problem occurred trying to convert the output.protected final BinaryFormat getBinaryFormat()
serializeToString(Object)
method on stream-based serializers when converting byte arrays to strings.OutputStreamSerializer.OSSERIALIZER_binaryFormat
public ObjectMap toMap()
Session
toMap
in class SerializerSession
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.