Class BytesResource
- java.lang.Object
-
- com.bumptech.glide.load.resource.bytes.BytesResource
-
-
Constructor Summary
Constructors Constructor Description BytesResource(byte[] bytes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]get()In most cases it will only be retrieved once (see linked methods).java.lang.Class<byte[]>getResourceClass()Returns theClassof the wrapped resource.intgetSize()Returns the size in bytes of the wrapped resource to use to determine how much of the memory cache this resource uses.voidrecycle()Cleans up and recycles internal resources.
-
-
-
Method Detail
-
getResourceClass
@NonNull public java.lang.Class<byte[]> getResourceClass()
Description copied from interface:ResourceReturns theClassof the wrapped resource.- Specified by:
getResourceClassin interfaceResource<byte[]>
-
get
@NonNull public byte[] get()
In most cases it will only be retrieved once (see linked methods).- Specified by:
getin interfaceResource<byte[]>- Returns:
- the same array every time, do not mutate the contents. Not a copy returned, because copying the array can be prohibitively expensive and/or lead to OOMs.
- See Also:
ResourceEncoder,ResourceTranscoder,SingleRequest.onResourceReady(com.bumptech.glide.load.engine.Resource<?>, com.bumptech.glide.load.DataSource, boolean)
-
getSize
public int getSize()
Description copied from interface:ResourceReturns the size in bytes of the wrapped resource to use to determine how much of the memory cache this resource uses.
-
recycle
public void recycle()
Description copied from interface:ResourceCleans up and recycles internal resources.It is only safe to call this method if there are no current resource consumers and if this method has not yet been called. Typically this occurs at one of two times:
- During a resource load when the resource is transformed or transcoded before any consumer have ever had access to this resource
- After all consumers have released this resource and it has been evicted from the cache
-
-