Class VBlob
Represents a VipsBlob, which is backed by a contiguous area of off-heap memory
Its constructor is package private to prevent leaking MemorySegments in to the vips-ffm API
Use its static helper methods to create new blobs
-
Method Summary
Modifier and TypeMethodDescriptionByteBuffer representation of the data in this blobDeprecated, for removal: This API element is subject to removal in a future version.ByteBuffer representation of the data in this bloblong
byteSize()
Size of the data in this blobDeprecated, for removal: This API element is subject to removal in a future version.Replaced bygetUnsafeStructAddress()
Not recommended for use, useasByteBuffer()
insteadGets the rawMemorySegment
(C pointer) for this VipsBlob structstatic VBlob
newFromBytes
(Arena arena, byte[] bytes) Creates a new VBlob from a fixed array of bytes
-
Method Details
-
newFromBytes
Creates a new VBlob from a fixed array of bytes
This must copy the data - it's generally more efficient to use
VImage.newFromFile(java.lang.foreign.Arena, java.lang.String, app.photofox.vipsffm.VipsOption...)
,VImage.newFromSource(java.lang.foreign.Arena, app.photofox.vipsffm.VSource, java.lang.String, app.photofox.vipsffm.VipsOption...)
, and friends- Parameters:
arena
- An arena constraining the lifetime of this blobbytes
- The bytes to wrap- Throws:
VipsError
-
getUnsafeAddress
@Deprecated(since="0.5.10", forRemoval=true) public MemorySegment getUnsafeAddress() throws VipsErrorDeprecated, for removal: This API element is subject to removal in a future version.Replaced bygetUnsafeStructAddress()
- Throws:
VipsError
-
getUnsafeStructAddress
Gets the raw
MemorySegment
(C pointer) for this VipsBlob structYou might want the data address instead
getUnsafeDataAddress()
The memory address' lifetime is bound to the scope of the
arena
Usage of the memory address is strongly discouraged, but it is available if some functionality is missing and you need to use it with
VipsHelper
- Throws:
VipsError
-
getUnsafeDataAddress
Not recommended for use, use
asByteBuffer()
insteadGets the raw
MemorySegment
(C pointer) for the data in this blobSliced to the length of the data, which isn't always null terminated
- Throws:
VipsError
-
byteSize
public long byteSize()Size of the data in this blob -
asByteBuffer
Deprecated, for removal: This API element is subject to removal in a future version.Replaced byasArenaScopedByteBuffer()
-
asArenaScopedByteBuffer
ByteBuffer representation of the data in this blob
Mapped to native memory via DirectByteBuffer, hence does not make a copy, so the data has the same data lifetime as
arena
-
asClonedByteBuffer
ByteBuffer representation of the data in this blob
A full copy of the data is taken, so that its contents are not coupled to the scope of
arena
-
asArenaScopedByteBuffer()