Package io.tiledb.java.api
Class VFS
- java.lang.Object
-
- io.tiledb.java.api.VFS
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class VFS extends java.lang.Object implements java.lang.AutoCloseable
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Free's native TileDB resources associated with the VFS objectjava.lang.String
createBucket(java.lang.String path)
Creates an object store bucket.java.net.URI
createBucket(java.net.URI uri)
Creates an object store bucket.java.lang.String
createDirectory(java.lang.String path)
Creates a directory resource at the given pathjava.net.URI
createDirectory(java.net.URI uri)
Creates a directory resource at the given URIjava.lang.String
createFile(java.lang.String path)
Creates an empty file resource at the given pathjava.net.URI
createFile(java.net.URI uri)
Creates an empty file resourcejava.lang.String
emptyBucket(java.lang.String path)
java.net.URI
emptyBucket(java.net.URI uri)
long
fileSize(java.lang.String path)
Returns the size of the VFS file resource in byteslong
fileSize(java.net.URI uri)
Returns the size fo the VFS file resource in bytesConfig
getConfig()
Returns the Config object associated with the VFS instanceContext
getContext()
Returns the Context associated with the VFS instanceprotected SWIGTYPE_p_tiledb_vfs_t
getVFSp()
Returns a handle to the underlying VFS SWIG pointerboolean
isBucket(java.lang.String path)
Checks if an object-store bucket exists.boolean
isBucket(java.net.URI uri)
Checks if an object-store bucket exists.boolean
isDirectory(java.lang.String path)
Checks if the given URI resource path is a directoryboolean
isDirectory(java.net.URI uri)
Checks if the given URI is a directory resourceboolean
isEmptyBucket(java.lang.String path)
Checks if an object-store bucket is emptyboolean
isEmtpyBucket(java.net.URI uri)
Checks if an object-store bucket is emptyboolean
isFile(java.lang.String path)
Checks if the given URI resource path string is a fileboolean
isFile(java.net.URI uri)
Checks if the given URI is a file resourceboolean
isSupportedFs(Filesystem fs)
Checks if the filesystem backend is supported for a given VFS instanceboolean
isSupportedFs(java.lang.String fs)
Checks if the filesystem backend is supported for a given VFS URI schemeboolean
isSupportedFs(java.net.URI uri)
Checks if the filesystem backend if supported for a given VFS URI (scheme)java.lang.String
moveDirectory(java.lang.String source, java.lang.String dest)
Renames a VFS directory resourcejava.net.URI
moveDirectory(java.net.URI source, java.net.URI dest)
Renames a VFS directory resourcejava.lang.String
moveFile(java.lang.String source, java.lang.String dest)
Renames a VFS file resourcejava.net.URI
moveFile(java.net.URI source, java.net.URI dest)
Renames a VFS file resourcebyte[]
readAllBytes(java.lang.String path)
Reads all the bytes from a VFS file resource.byte[]
readAllBytes(java.net.URI path)
java.lang.String
removeBucket(java.lang.String path)
Deletes an object-store bucket.java.net.URI
removeBucket(java.net.URI uri)
Deletes an object-store bucket.java.lang.String
removeDirectory(java.lang.String path)
Removes a VFS directory resource (if exists)java.net.URI
removeDirectory(java.net.URI uri)
Removes a VFS directory resource (if exists)java.lang.String
removeFile(java.lang.String path)
Removes a VFS file resource (if exists)java.net.URI
removeFile(java.net.URI uri)
Removes a VFS file resource (if exists)java.lang.String
write(java.lang.String path, byte[] bytes, VFSMode... mode)
Write bytes to a given VFS file resource.java.net.URI
write(java.net.URI uri, byte[] bytes, VFSMode... mode)
Write bytes to a given VFS file resource.
-
-
-
Constructor Detail
-
VFS
public VFS(Context ctx, Config config) throws TileDBError
Constructor for creating new TileDB VFS handle with a given configuration- Parameters:
ctx
- The TileDB contextconfig
- A TileDB config object- Throws:
TileDBError
- A TileDB exception
-
VFS
public VFS(Context ctx) throws TileDBError
Constructor for creating a new TileDB VFS handle- Parameters:
ctx
- A TileDB context- Throws:
TileDBError
- A TileDB exception
-
-
Method Detail
-
getVFSp
protected SWIGTYPE_p_tiledb_vfs_t getVFSp()
Returns a handle to the underlying VFS SWIG pointer- Returns:
- A SWIG pointer wrapper to a tiledb_vfs_t object handle
-
getConfig
public Config getConfig() throws TileDBError
Returns the Config object associated with the VFS instance- Returns:
- THe Config object
- Throws:
TileDBError
- A TileDB exception
-
getContext
public Context getContext()
Returns the Context associated with the VFS instance- Returns:
- A TileDB Context object
-
isSupportedFs
public boolean isSupportedFs(Filesystem fs) throws TileDBError
Checks if the filesystem backend is supported for a given VFS instance- Parameters:
fs
- TileDB Filesystem enum- Returns:
- true if the filesystem is supported, false otherwise
- Throws:
TileDBError
- A TileDB excpetion
-
isSupportedFs
public boolean isSupportedFs(java.lang.String fs) throws TileDBError
Checks if the filesystem backend is supported for a given VFS URI scheme- Parameters:
fs
- TileDB filesystem string (ex. file, file://, s3, s3://, hdfs, hdfs://)- Returns:
- true if the filesystem backend is supported, false otherwise
- Throws:
TileDBError
- A TileDB exception
-
isSupportedFs
public boolean isSupportedFs(java.net.URI uri) throws TileDBError
Checks if the filesystem backend if supported for a given VFS URI (scheme)- Parameters:
uri
- A URI with a given scheme- Returns:
- true if the uri scheme backend is supported, false otherwise
- Throws:
TileDBError
- A TileDB exception
-
isBucket
public boolean isBucket(java.lang.String path) throws TileDBError
Checks if an object-store bucket exists.- Parameters:
path
- String URI path to bucket resource- Returns:
- true if the bucket exists, false otherwise
- Throws:
TileDBError
- A TileDB exception
-
isBucket
public boolean isBucket(java.net.URI uri) throws TileDBError
Checks if an object-store bucket exists.- Parameters:
uri
- URI to bucket resource- Returns:
- true if the bucket exists, false otherwise
- Throws:
TileDBError
- A TileDB exception
-
createBucket
public java.lang.String createBucket(java.lang.String path) throws TileDBError
Creates an object store bucket.- Parameters:
path
- String URI path of bucket to be created- Returns:
- String URI of created bucket
- Throws:
TileDBError
- A TileDB exception
-
createBucket
public java.net.URI createBucket(java.net.URI uri) throws TileDBError
Creates an object store bucket.- Parameters:
uri
- URI of bucket to be created- Returns:
- The URI of the created bucket
- Throws:
TileDBError
- A TileDB exception
-
removeBucket
public java.lang.String removeBucket(java.lang.String path) throws TileDBError
Deletes an object-store bucket.- Parameters:
path
- String URI path of bucket to be delted- Returns:
- String URI of deleted bucket
- Throws:
TileDBError
- A TileDB excpetion
-
removeBucket
public java.net.URI removeBucket(java.net.URI uri) throws TileDBError
Deletes an object-store bucket.- Parameters:
uri
- URI of bucket to be deleted- Returns:
- URI of deleted bucket
- Throws:
TileDBError
- A TileDB exception
-
isEmptyBucket
public boolean isEmptyBucket(java.lang.String path) throws TileDBError
Checks if an object-store bucket is empty- Parameters:
path
- A String uri of the bucket- Returns:
- true if the bucket is empty, false otherwise
- Throws:
TileDBError
- A TileDB exception
-
isEmtpyBucket
public boolean isEmtpyBucket(java.net.URI uri) throws TileDBError
Checks if an object-store bucket is empty- Parameters:
uri
- URI of the bucket- Returns:
- Throws:
TileDBError
-
emptyBucket
public java.lang.String emptyBucket(java.lang.String path) throws TileDBError
- Parameters:
path
-- Returns:
- Throws:
TileDBError
- A TileDB exception
-
emptyBucket
public java.net.URI emptyBucket(java.net.URI uri) throws TileDBError
- Parameters:
uri
-- Returns:
- Throws:
TileDBError
- A TileDB exception
-
isFile
public boolean isFile(java.lang.String path) throws TileDBError
Checks if the given URI resource path string is a file- Parameters:
path
- String URI path to file resource- Returns:
- true if the given resource path is a file, false otherwise
- Throws:
TileDBError
- A TileDB exception
-
isFile
public boolean isFile(java.net.URI uri) throws TileDBError
Checks if the given URI is a file resource- Parameters:
uri
- URI path to resource- Returns:
- true if the given resource path is a file, false otherwise
- Throws:
TileDBError
- A TileDB exception
-
isDirectory
public boolean isDirectory(java.lang.String path) throws TileDBError
Checks if the given URI resource path is a directory- Parameters:
path
- String URI path to directory resource- Returns:
- true if the given resource path is a directory, false otherwise
- Throws:
TileDBError
- A TileDB exception
-
isDirectory
public boolean isDirectory(java.net.URI uri) throws TileDBError
Checks if the given URI is a directory resource- Parameters:
uri
- URI path to resource- Returns:
- true if the given uri is a directory resource, false otherwise
- Throws:
TileDBError
- A TileDB exception
-
createDirectory
public java.lang.String createDirectory(java.lang.String path) throws TileDBError
Creates a directory resource at the given path- Parameters:
path
- String URI path of directory to create- Returns:
- String URI path of created directory
- Throws:
TileDBError
- A TileDB exception
-
createDirectory
public java.net.URI createDirectory(java.net.URI uri) throws TileDBError
Creates a directory resource at the given URI- Parameters:
uri
- URI of directory to create- Returns:
- URI of the created directory
- Throws:
TileDBError
- A TileDB exception
-
createFile
public java.lang.String createFile(java.lang.String path) throws TileDBError
Creates an empty file resource at the given path- Parameters:
path
- String URI path of the empty file to create- Returns:
- String URI path of created file
- Throws:
TileDBError
- A TileDB exception
-
createFile
public java.net.URI createFile(java.net.URI uri) throws TileDBError
Creates an empty file resource- Parameters:
uri
- URI of file to create- Returns:
- URI of created file
- Throws:
TileDBError
- A TileDB exception
-
removeDirectory
public java.lang.String removeDirectory(java.lang.String path) throws TileDBError
Removes a VFS directory resource (if exists)- Parameters:
path
- String URI path of the directory to remove- Returns:
- String uri path of removed directory
- Throws:
TileDBError
- A TileDB Exception
-
removeDirectory
public java.net.URI removeDirectory(java.net.URI uri) throws TileDBError
Removes a VFS directory resource (if exists)- Parameters:
uri
- URI of directory to remove- Returns:
- URI of removed directory
- Throws:
TileDBError
- A TileDB exception
-
removeFile
public java.lang.String removeFile(java.lang.String path) throws TileDBError
Removes a VFS file resource (if exists)- Parameters:
path
- String URI path of the file to remove- Returns:
- String uri path of removed file
- Throws:
TileDBError
- A TileDB exception
-
removeFile
public java.net.URI removeFile(java.net.URI uri) throws TileDBError
Removes a VFS file resource (if exists)- Parameters:
uri
- URI of the file to remove- Returns:
- URI of the removed file
- Throws:
TileDBError
-
fileSize
public long fileSize(java.lang.String path) throws TileDBError
Returns the size of the VFS file resource in bytes- Parameters:
path
- String URI path of the file- Returns:
- File size in bytes
- Throws:
TileDBError
- A TileDB exception
-
fileSize
public long fileSize(java.net.URI uri) throws TileDBError
Returns the size fo the VFS file resource in bytes- Parameters:
uri
- URI of file resource- Returns:
- File size in bytes
- Throws:
TileDBError
- A TileDB exception
-
moveDirectory
public java.lang.String moveDirectory(java.lang.String source, java.lang.String dest) throws TileDBError
Renames a VFS directory resource- Parameters:
source
- Old URI stringdest
- New URI string- Returns:
- String URI path of moved file resou
- Throws:
TileDBError
-
moveDirectory
public java.net.URI moveDirectory(java.net.URI source, java.net.URI dest) throws TileDBError
Renames a VFS directory resource- Parameters:
source
- Old URIdest
- New URI- Returns:
- URI of moved directory resource
- Throws:
TileDBError
-
moveFile
public java.lang.String moveFile(java.lang.String source, java.lang.String dest) throws TileDBError
Renames a VFS file resource- Parameters:
source
- Old URI stringdest
- New URI string- Returns:
- String URI path of moved file resource
- Throws:
TileDBError
- A TileDB exception
-
moveFile
public java.net.URI moveFile(java.net.URI source, java.net.URI dest) throws TileDBError
Renames a VFS file resource- Parameters:
source
- Old URIdest
- New URI- Returns:
- URI of moved file resource
- Throws:
TileDBError
- A TileDB exception
-
readAllBytes
public byte[] readAllBytes(java.lang.String path) throws TileDBError
Reads all the bytes from a VFS file resource.Ensures that the file has been closed when all bytes have been read or an IO error is thrown. This is a convenience method and is not intended for reading large VFS files.
- Parameters:
path
- the string URI path to the file resource- Returns:
- a byte array containing
- Throws:
TileDBError
-
readAllBytes
public byte[] readAllBytes(java.net.URI path) throws TileDBError
- Throws:
TileDBError
-
write
public java.lang.String write(java.lang.String path, byte[] bytes, VFSMode... mode) throws TileDBError
Write bytes to a given VFS file resource.- Parameters:
path
- The URI string resource pathbytes
- The byte array with the bytes to writemode
- VFSMode specifying how the file is opened, defaults to TILEDB_VFS_WRITE if unspecified- Returns:
- The URI string resource path
- Throws:
TileDBError
- A TileDB exception
-
write
public java.net.URI write(java.net.URI uri, byte[] bytes, VFSMode... mode) throws TileDBError
Write bytes to a given VFS file resource.- Parameters:
uri
- The URI string resource pathbytes
- The byte array with the bytes to writemode
- VFSMode specifying how the file is opened, defaults to TILEDB_VFS_WRITE if unspecified- Returns:
- The URI string resource path
- Throws:
TileDBError
- A TileDB exception
-
close
public void close()
Free's native TileDB resources associated with the VFS object- Specified by:
close
in interfacejava.lang.AutoCloseable
-
-