Module dev.hydraulic.types
Package dev.hydraulic.types.mimetyped
Class MimeTypedObject<T,M extends MimeType>
java.lang.Object
dev.hydraulic.types.mimetyped.MimeTypedObject<T,M>
- Type Parameters:
T- The type of object that is wrapped.M- A marker type that isn't represented or stored at runtime. It exists only for source documentation, type inference, reflection and languages that have extension functions. So, feel free to use a wildcard type here, you won't lose anything except some type safety.
- All Implemented Interfaces:
MimeTyped<T,M>
A value-based type that wraps an object (byte array, byte buffer, stream, or any arbitrary object) with an associated MIME type or
MIME type registry.
-
Constructor Summary
ConstructorsConstructorDescriptionMimeTypedObject(T content, String mimeType) Constructs an immutable mime-typed string. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> MimeTypedObject<T,MimeType.application> application(T content, String subtype) application/subtypecontent()The wrapped content.booleaninthashCode()static <T> MimeTypedObject<T,MimeType.image> image/subtypemimeType()The MIME type.static <T> MimeTypedObject<T,MimeType.application.octetStream> octetStream(T content) application/octet-streamtoString()Returns[mime/type] content.
-
Constructor Details
-
MimeTypedObject
Constructs an immutable mime-typed string.- Parameters:
content- The wrapped string.mimeType- A MIME type.
-
-
Method Details
-
octetStream
application/octet-stream -
image
image/subtype -
application
application/subtype -
mimeType
The MIME type. -
content
The wrapped content. -
equals
-
hashCode
public int hashCode() -
toString
Returns[mime/type] content.
-