Class PetPhotoSerializer
java.lang.Object
org.apache.juneau.marshall.Context
org.apache.juneau.marshall.MarshallingContextable
org.apache.juneau.marshall.MarshallingTraverseContext
org.apache.juneau.marshall.serializer.Serializer
org.apache.juneau.marshall.serializer.OutputStreamSerializer
org.apache.juneau.petstore.marshall.PetPhotoSerializer
- All Implemented Interfaces:
Function<Object,,byte[]> ThrowingFunction<Object,byte[]>
Serializes
BufferedImage pet photos to image/png/image/jpeg byte streams.
Petstore-local port of the deleted juneau-examples-rest image demo, relocated here (rather than
juneau-examples-core) so juneau-petstore-core stays free of any dependency on the examples
modules. Wired into PetStoreResource.getPetPhoto(long).
See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.juneau.marshall.serializer.OutputStreamSerializer
OutputStreamSerializer.Builder<SELF extends OutputStreamSerializer.Builder<SELF>>, OutputStreamSerializer.DefaultBuilderNested classes/interfaces inherited from class org.apache.juneau.marshall.serializer.Serializer
Serializer.Null -
Field Summary
Fields inherited from class org.apache.juneau.marshall.serializer.Serializer
accept, addBeanTypes, addRootType, keepNullProperties, listener, nonDefault, produces, sortCollections, sortMaps, trimEmptyCollections, trimEmptyMaps, trimStringsFields inherited from class org.apache.juneau.marshall.MarshallingContextable
marshallingContextFields inherited from class org.apache.juneau.marshall.Context
CONTEXT_APPLY_FILTER -
Constructor Summary
ConstructorsConstructorDescriptionConstructor with default settings (produces image/png and image/jpeg). -
Method Summary
Modifier and TypeMethodDescriptionvoiddoWrite(SerializerSession session, SerializerPipe pipe, Object o) Serializes a POJO to the specified pipe.Methods inherited from class org.apache.juneau.marshall.serializer.OutputStreamSerializer
applyThrows, create, createSession, getBinaryFormat, getSession, isWriterSerializer, writeMethods inherited from class org.apache.juneau.marshall.serializer.Serializer
copy, createSerializerBuilder, forEachAcceptMediaType, getListener, getMediaTypeRanges, getPrimaryMediaType, getResponseContentType, getResponseHeaders, getUriContext, getUriRelativity, getUriResolution, isAddBeanTypes, isAddRootType, isKeepNullProperties, isNonDefault, isSortCollections, isSortMaps, isTrimEmptyCollections, isTrimEmptyMaps, isTrimStrings, properties, write, writeToStringMethods inherited from class org.apache.juneau.marshall.MarshallingTraverseContext
getDetectRecursions, getIgnoreRecursions, getInitialDepth, getMaxDepth, isDetectRecursions, isIgnoreRecursions, shouldDetectRecursionsMethods inherited from class org.apache.juneau.marshall.MarshallingContextable
getDurationFormat, getMarshallingContext, getPeriodFormatMethods inherited from class org.apache.juneau.marshall.Context
createBuilder, getAnnotationProvider, init, isDebug, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.juneau.commons.function.ThrowingFunction
apply
-
Constructor Details
-
PetPhotoSerializer
public PetPhotoSerializer()Constructor with default settings (produces image/png and image/jpeg).
-
-
Method Details
-
doWrite
public void doWrite(SerializerSession session, SerializerPipe pipe, Object o) throws IOException, SerializeException Serializes a POJO to the specified pipe.- Overrides:
doWritein classSerializer- Parameters:
session- The current session.pipe- 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.
-