public final class BlobFile extends Object implements Closeable
Usage example (try-with-resources for automatic resource management):
try (BlobFile blob = dataset.takeBlob()) {
long size = blob.size();
byte[] data = blob.read(); // Read all content
blob.seek(1024);
byte[] partial = blob.readUpTo(512); // Read 512 bytes from position 1024
} catch (IOException e) {
// Handle IO errors
}
Auto-closes after try block, no manual close needed.| Constructor and Description |
|---|
BlobFile()
Default no-arg constructor used by JNI to attach native handle.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close BlobFile and release associated resources.
|
byte[] |
read()
Read all remaining bytes from current cursor to end.
|
byte[] |
readUpTo(int len)
Read up to len bytes from the current cursor.
|
void |
seek(long newCursor)
Seek to a new cursor position.
|
long |
size()
Return blob size in bytes.
|
long |
tell()
Return current cursor position.
|
public BlobFile()
public byte[] read()
throws IOException
IOExceptionpublic byte[] readUpTo(int len)
throws IOException
IOExceptionpublic void seek(long newCursor)
throws IOException
IOExceptionpublic long tell()
throws IOException
IOExceptionpublic long size()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2025. All rights reserved.