public interface ILoadPaths
The Venice function 'load-file' and file I/O functions can be
bound to load resources from restricted paths only.
Load paths are part of Venice's Sandbox to control where
files can be loaded from.
Use the LoadPathsFactory for creating load paths.
LoadPathsFactory| Modifier and Type | Method and Description |
|---|---|
boolean |
active() |
java.io.BufferedReader |
getBufferedReader(java.io.File file,
java.nio.charset.Charset charset)
Returns a
BufferedReader for a file from the load paths |
java.io.InputStream |
getInputStream(java.io.File file)
Returns an
InputStream for a file from the load paths |
java.io.OutputStream |
getOutputStream(java.io.File file,
java.nio.file.OpenOption... options)
Returns an
OutputStream for a file from the load paths |
java.util.List<java.io.File> |
getPaths() |
boolean |
isDirectoryOnLoadPath(java.io.File file,
com.github.jlangch.venice.impl.util.loadpath.Access mode)
Returns
true if the directory exists on the load path |
boolean |
isOnLoadPath(java.io.File file,
com.github.jlangch.venice.impl.util.loadpath.Access mode)
Checks if the passed file is within the load paths.
|
boolean |
isRegularFileOnLoadPath(java.io.File file,
com.github.jlangch.venice.impl.util.loadpath.Access mode)
Returns
true if the regular file exists on the load path |
boolean |
isUnlimitedAccess() |
java.nio.ByteBuffer |
loadBinaryResource(java.io.File file)
Loads a binary resources file from the load paths
|
java.lang.String |
loadTextResource(java.io.File file,
java.nio.charset.Charset charset)
Loads a text resources file from the load paths
|
java.lang.String |
loadVeniceFile(java.io.File file)
Load a Venice script file from the load paths
|
java.io.File |
normalize(java.io.File file)
Normalizes a file regarding the load paths.
|
java.lang.String loadVeniceFile(java.io.File file)
file - A Venice script file to load. Adds a '.venice' file
extension implicitly if missing.null if not foundjava.nio.ByteBuffer loadBinaryResource(java.io.File file)
file - A file to load.null if not foundjava.lang.String loadTextResource(java.io.File file,
java.nio.charset.Charset charset)
file - A file to load.charset - an optional text encoding like 'UTF-8'.
'UTF-8' on passing nullnull if not foundjava.io.InputStream getInputStream(java.io.File file)
InputStream for a file from the load pathsfile - A file to return an InputStream.InputStream or null if not foundjava.io.BufferedReader getBufferedReader(java.io.File file,
java.nio.charset.Charset charset)
BufferedReader for a file from the load pathsfile - A file to return an BufferedReader.charset - an optional text encoding like 'UTF-8'.
'UTF-8' on passing nullBufferedReader or null if not foundjava.io.OutputStream getOutputStream(java.io.File file,
java.nio.file.OpenOption... options)
OutputStream for a file from the load paths
If no options are
present then this method works as if the CREATE, TRUNCATE_EXISTING,
and WRITE options are present. In other
words, it opens the file for writing, creating the file if it doesn't
exist, or initially truncating an existing regular-file to a size of
0 if it exists.
file - A file to return an BufferedReader.options - options specifying how the file is openedOutputStream or null if not foundboolean isRegularFileOnLoadPath(java.io.File file,
com.github.jlangch.venice.impl.util.loadpath.Access mode)
true if the regular file exists on the load pathfile - a filemode - an access mode: read, write, read/writetrue if the file exists on the load pathboolean isDirectoryOnLoadPath(java.io.File file,
com.github.jlangch.venice.impl.util.loadpath.Access mode)
true if the directory exists on the load pathfile - a filemode - an access mode: read, write, read/writetrue if the file exists on the load pathboolean isOnLoadPath(java.io.File file,
com.github.jlangch.venice.impl.util.loadpath.Access mode)
file - a file to checkmode - an access mode: read, write, read/writejava.io.File normalize(java.io.File file)
file - a fileboolean isUnlimitedAccess()
true if the access to files is unlimited or
false if the access is limited to the load paths.java.util.List<java.io.File> getPaths()
ILoadPaths objectboolean active()