Class JsonlSerializerSession
- All Implemented Interfaces:
BeanSession,ConverterSession,ArrayRecordWritable,RecordWritable,TokenWritable
- Direct Known Subclasses:
Json5lSerializerSession
JsonlSerializer.
Notes:
- This class is not thread safe and is typically discarded after one use.
See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.apache.juneau.marshall.json.JsonSerializerSession
JsonSerializerSession.DefaultBuilder -
Field Summary
Fields inherited from class org.apache.juneau.marshall.MarshallingTraverseSession
indentFields inherited from class org.apache.juneau.marshall.MarshallingSession
NAME_PROPERTY_NAME -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructor. -
Method Summary
Modifier and TypeMethodDescriptioncreate(JsonlSerializer ctx) Creates a new builder for this object.protected voiddoWrite(SerializerPipe out, Object o) Serializes a POJO to the specified pipe.writeArrayRecords(Object output) Streaming array-elementRecordWriterfor JSONL.writeTokens(Object output) Opens a low-level push generator that emits JSONL one structural event at a time, with a trailing newline after every top-level value, bound to this live session.Methods inherited from class org.apache.juneau.marshall.json.JsonSerializerSession
create, getJsonClassMeta, getJsonWriter, isAddBeanTypes, isEscapeSolidus, isSimpleAttrs, writeAnything, writeBeanMap, writeJson, writeMapMethods inherited from class org.apache.juneau.marshall.serializer.WriterSerializerSession
create, createPipe, getMaxIndent, getQuoteChar, getStreamCharset, isUseWhitespace, isWriterSerializer, properties, write, writeToStringMethods inherited from class org.apache.juneau.marshall.serializer.SerializerSession
addVarBean, canIgnoreValue, canIgnoreValue, create, createBeanTypeNameProperty, createDefaultVarResolverSession, forEachEntry, forEachEntry, forEachStreamableEntry, generalize, getBeanTypeName, getCalendarFormat, getDateFormat, getDurationFormat, getExpectedRootType, getJavaMethod, getListener, getListener, getLocaleFormat, getPeriodFormat, getResponseHeaders, getSchema, getTemporalFormat, getTimeZoneFormat, getUriContext, getUriRelativity, getUriResolution, getUriResolver, getVarResolver, handleThrown, isAddRootType, isKeepNullProperties, isNonDefault, isSortCollections, isSortMaps, isTrimEmptyCollections, isTrimEmptyMaps, isTrimStrings, onBeanGetterException, onError, push2, relativizeUri, resolve, resolveUri, sort, sort, sort, swap, toList, toListFromStreamable, toString, trim, unwrapSupplier, write, writeCalendar, writeDate, writeDuration, writePeriod, writeTemporalMethods inherited from class org.apache.juneau.marshall.MarshallingTraverseSession
getInitialDepth, getLastLocation, getMaxDepth, getOptionalType, getOptionalValue, getStack, isDetectRecursions, isIgnoreRecursions, isOptional, isRoot, pop, push, setCurrentClass, setCurrentProperty, willExceedDepth, willRecurseMethods inherited from class org.apache.juneau.marshall.MarshallingSession
addWarning, convertToMemberType, convertToMemberType, convertToMemberType, convertToType, convertToType, convertToType, convertToType, create, get, getActiveView, getAnnotationProvider, getArgsClassMeta, getBeanClassVisibility, getBeanConstructorVisibility, getBeanDictionary, getBeanFieldVisibility, getBeanMeta, getBeanMethodVisibility, getBeanRegistry, getBeanTypePropertyName, getBeanTypePropertyName, getClassLoader, getClassMeta, getClassMeta, getClassMetaForObject, getClassMetaForObject, getLocale, getMarshallingContext, getMediaType, getNotBeanClasses, getNotBeanPackagesNames, getPropertyNamer, getSwaps, getTimeZone, getTimeZoneId, isBean, isBean, isBeanMapPutReturnsOldValue, isBeansRequireDefaultConstructor, isBeansRequireSerializable, isBeansRequireSettersForGetters, isBeansRequireSomeProperties, isFindFluentSetters, isIgnoreInvocationExceptionsOnGetters, isIgnoreInvocationExceptionsOnSetters, isIgnoreMissingSetters, isIgnoreUnknownBeanProperties, isIgnoreUnknownNullBeanProperties, isPropertyInActiveView, isRecordComponentOrder, isUnsortedProperties, isUseInterfaceProxies, isUseJavaBeanIntrospector, isValidateSchema, newBean, newBean, newBeanMap, newBeanMap, newGenericList, newGenericMap, newGenericMap, object, parseToList, parseToMap, string, toArray, toBeanMap, toBeanMap, toBeanMapMethods inherited from class org.apache.juneau.marshall.ContextSession
checkForWarnings, getContext, getSessionProperties, getWarnings, isDebug, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.juneau.marshall.stream.ArrayRecordWritable
isArrayRecordStreaming, writeArrayRecordsMethods inherited from interface org.apache.juneau.commons.conversion.ConverterSession
getMethods inherited from interface org.apache.juneau.marshall.stream.RecordWritable
isRecordStreamingMethods inherited from interface org.apache.juneau.marshall.stream.TokenWritable
writeRecords
-
Constructor Details
-
JsonlSerializerSession
Constructor.- Parameters:
builder- The builder for this object.
-
-
Method Details
-
create
Creates a new builder for this object.- Parameters:
ctx- The context creating this session.
Cannot benull .- Returns:
- A new builder.
-
writeTokens
Opens a low-level push generator that emits JSONL one structural event at a time, with a trailing newline after every top-level value, bound to this live session.Same honored/ignored builder properties as
JsonSerializerSession.writeTokens(Object)except thatuseWhitespace is forced tofalse — pretty-printed JSONL is not standard.- Specified by:
writeTokensin interfaceTokenWritable- Overrides:
writeTokensin classJsonSerializerSession- Parameters:
output- The output.- Returns:
- A new
JsonlTokenWriter. - Throws:
IOException- If the output type is not supported or could not be opened.
-
writeArrayRecords
Streaming array-elementRecordWriterfor JSONL.Unlike the inherited
JsonSerializerSession.writeArrayRecords(Object)— which wraps the writes in a bracketed top-level[...] array and is invalid for line-delimited JSONL — this aliases the JSONL line record stream: theJsonlTokenWriterreturned bywriteTokens(Object)is itself aRecordWriterwhosewrite(...)emits one top-level value per line (no surrounding brackets). Memory is O(1) in the number of records.- Specified by:
writeArrayRecordsin interfaceArrayRecordWritable- Overrides:
writeArrayRecordsin classJsonSerializerSession- Parameters:
output- The output.- Returns:
- A new line-delimited
RecordWriter. - Throws:
IOException- If a problem occurred opening the underlying output.
-
doWrite
Description copied from class:SerializerSessionSerializes a POJO to the specified pipe.This method should NOT close the context object.
The default implementation of this method simply calls
Serializer.doWrite(SerializerSession,SerializerPipe,Object).- Overrides:
doWritein classJsonSerializerSession- Parameters:
out- Where to send the output from the serializer.o- The object to serialize.- Throws:
IOException- Thrown by underlying stream.SerializeException- Problem occurred trying to serialize object.
-