.. java:import:: com.google.common.io Files .. java:import:: java.io File .. java:import:: java.io FileOutputStream .. java:import:: java.io IOException .. java:import:: java.io InputStream .. java:import:: java.io OutputStream .. java:import:: java.nio.file Path .. java:import:: java.security MessageDigest .. java:import:: java.security NoSuchAlgorithmException .. java:import:: java.util.regex Pattern .. java:import:: org.apache.commons.fileupload FileItemStream .. java:import:: org.caosdb.server.database.access Access .. java:import:: org.caosdb.server.database.backend.transaction GetFileRecordByPath .. java:import:: org.caosdb.server.database.exceptions EntityDoesNotExistException .. java:import:: org.caosdb.server.database.misc TransactionBenchmark .. java:import:: org.caosdb.server.entity EntityID .. java:import:: org.caosdb.server.entity EntityInterface .. java:import:: org.caosdb.server.entity FileProperties .. java:import:: org.caosdb.server.entity Message .. java:import:: org.caosdb.server.utils FileUtils .. java:import:: org.caosdb.server.utils ServerMessages .. java:import:: org.caosdb.server.utils Utils FileSystem ========== .. java:package:: org.caosdb.server :noindex: .. java:type:: public class FileSystem Fields ------ base32Pattern ^^^^^^^^^^^^^ .. java:field:: public static final Pattern base32Pattern :outertype: FileSystem Methods ------- assertDir ^^^^^^^^^ .. java:method:: public static final String assertDir(String sessionString) throws IOException :outertype: FileSystem Asserts that a temporary directory for this session exists, creating it if necessary. :param sessionString: The session string for which the directory is guaranteed to exist after calling this function. If `session` is Null, a random directory will be created. :return: A String with the existing directory. checkTarget ^^^^^^^^^^^ .. java:method:: public static boolean checkTarget(EntityInterface entity, Access access, TransactionBenchmark b) throws Message :outertype: FileSystem Checks if a target path is consistent with the server's configuration and the file system. :param entity: :throws Message: getBasepath ^^^^^^^^^^^ .. java:method:: public static String getBasepath() :outertype: FileSystem getDropOffBox ^^^^^^^^^^^^^ .. java:method:: public static String getDropOffBox() :outertype: FileSystem getFromFileSystem ^^^^^^^^^^^^^^^^^ .. java:method:: public static File getFromFileSystem(String path) :outertype: FileSystem Get the file from the internal file system. Returns null if the file does not exist. :param path: getFromShared ^^^^^^^^^^^^^ .. java:method:: public static File getFromShared(String path) :outertype: FileSystem Get the file from the shared files folder. Conditions under which null is returned: The file does not exist.The file is a folder.The requested path is just a file, without parent folders.The requested path is not normalized.The first component of the path does not match the base32 pattern for shared folders. :param path: The path to the requested file. :return: File getPath ^^^^^^^ .. java:method:: public static String getPath(String location) throws Message :outertype: FileSystem Return the canonical path on the native file system of the server's host which is guaranteed to be a valid path under the server's internal file system. :param location: :throws Message: TARGET_PATH_NOT_ALLOWED if location does not belong to the file system. :return: A canonical path. getShared ^^^^^^^^^ .. java:method:: public static String getShared() :outertype: FileSystem getTmp ^^^^^^ .. java:method:: public static String getTmp() :outertype: FileSystem init ^^^^ .. java:method:: public static void init() :outertype: FileSystem pickUp ^^^^^^ .. java:method:: public static final FileProperties pickUp(String path, String session) throws Message :outertype: FileSystem Pick up file from DropOffBox and load it into tmp dir. :param path: :param session: :throws NoSuchAlgorithmException: :throws IOException: :throws Message: :throws CaosDBException: :throws InterruptedException: :return: A FileProperties Object which represents the object in the tmp dir. upload ^^^^^^ .. java:method:: public static final FileProperties upload(FileItemStream item, String session) throws NoSuchAlgorithmException, IOException, CaosDBException :outertype: FileSystem Reads a FileItemStream and stores the file into the tmpfolder. Generates FileProperties. :param item: :param session: :throws NoSuchAlgorithmException: :throws IOException: :throws CaosDBException: :return: FileProperties of the uploaded File.