Package com.onec.ui.media
Record Class LoadedMedia
java.lang.Object
java.lang.Record
com.onec.ui.media.LoadedMedia
- Record Components:
resource- the readable bytescontentType- the content type to send back (nevernull)size- the size in bytes, or-1if unknownfilename- the original filename for aContent-Dispositionhint, ornull
public record LoadedMedia(org.springframework.core.io.Resource resource, String contentType, long size, String filename)
extends Record
A stored binary read back for serving, returned from
MediaStorage.load(java.lang.String). Backends that
keep bytes the framework can stream (filesystem) return one of these so GET /api/media/...
can pipe it to the client; backends that hand out their own public URLs (e.g. a public S3 bucket)
have no need to implement load — the persisted url points straight at them.-
Constructor Summary
ConstructorsConstructorDescriptionLoadedMedia(org.springframework.core.io.Resource resource, String contentType, long size, String filename) Creates an instance of aLoadedMediarecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecontentTyperecord component.final booleanIndicates whether some other object is "equal to" this one.filename()Returns the value of thefilenamerecord component.final inthashCode()Returns a hash code value for this object.org.springframework.core.io.Resourceresource()Returns the value of theresourcerecord component.longsize()Returns the value of thesizerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
LoadedMedia
public LoadedMedia(org.springframework.core.io.Resource resource, String contentType, long size, String filename) Creates an instance of aLoadedMediarecord class.- Parameters:
resource- the value for theresourcerecord componentcontentType- the value for thecontentTyperecord componentsize- the value for thesizerecord componentfilename- the value for thefilenamerecord component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
resource
public org.springframework.core.io.Resource resource()Returns the value of theresourcerecord component.- Returns:
- the value of the
resourcerecord component
-
contentType
Returns the value of thecontentTyperecord component.- Returns:
- the value of the
contentTyperecord component
-
size
public long size()Returns the value of thesizerecord component.- Returns:
- the value of the
sizerecord component
-
filename
Returns the value of thefilenamerecord component.- Returns:
- the value of the
filenamerecord component
-