public abstract class FileUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.Class |
aclEntryBuilderClz |
private static java.lang.Class |
aclEntryClz |
private static java.lang.Class |
aclEntryPermissionClz |
private static java.lang.Class |
aclEntryTypeClz |
private static java.lang.Class |
aclFileAttributeViewClz |
private static java.lang.reflect.Field |
allow |
private static int |
BUFFER_SIZE |
private static java.lang.reflect.Method |
build |
private static java.lang.Class |
fileClz |
private static java.lang.Class |
filesClz |
private static java.lang.Class |
fileStoreClz |
private static java.lang.reflect.Method |
get |
private static java.lang.reflect.Method |
getAcl |
private static java.lang.reflect.Method |
getFileAttributeView |
private static java.lang.reflect.Method |
getFileStore |
private static java.lang.reflect.Method |
getName |
private static java.lang.reflect.Method |
getOwner |
private static boolean |
initialized |
private static java.lang.Class |
linkOptionArrayClz |
private static java.lang.Class |
linkOptionClz |
private static java.lang.reflect.Method |
newBuilder |
private static java.lang.Class |
pathClz |
private static java.lang.Class |
pathsClz |
private static java.lang.Class |
posixFileAttributeViewClz |
private static java.lang.reflect.Method |
principal |
private static java.lang.Object |
region |
private static java.lang.reflect.Method |
setAcl |
private static java.lang.reflect.Method |
setExec |
private static java.lang.reflect.Method |
setPermissions |
private static java.lang.reflect.Method |
setPrincipal |
private static java.lang.reflect.Method |
setRead |
private static java.lang.reflect.Method |
setType |
private static java.lang.reflect.Method |
setWrite |
private static java.lang.Class |
stringArrayClz |
private static java.lang.reflect.Method |
supportsFileAttributeView |
private static java.lang.Class |
userPrincipalClz |
private static java.lang.reflect.Method |
values |
Constructor and Description |
---|
FileUtil() |
Modifier and Type | Method and Description |
---|---|
private static void |
assertTrue(java.lang.Object r) |
static boolean |
copyDirectory(java.io.File from,
java.io.File to)
Copy a directory and all of its contents.
|
static boolean |
copyDirectory(java.io.File from,
java.io.File to,
byte[] buffer,
java.lang.String[] filter) |
static boolean |
copyDirectory(StorageFactory storageFactory,
StorageFile from,
java.io.File to,
byte[] buffer,
java.lang.String[] filter,
boolean copySubDirs) |
static boolean |
copyDirectory(java.lang.String from,
java.lang.String to) |
static boolean |
copyDirectory(WritableStorageFactory storageFactory,
java.io.File from,
StorageFile to) |
static boolean |
copyDirectory(WritableStorageFactory storageFactory,
java.io.File from,
StorageFile to,
byte[] buffer,
java.lang.String[] filter) |
static boolean |
copyFile(java.io.File from,
java.io.File to,
byte[] buf) |
static boolean |
copyFile(StorageFactory storageFactory,
StorageFile from,
java.io.File to) |
static boolean |
copyFile(StorageFactory storageFactory,
StorageFile from,
java.io.File to,
byte[] buf) |
static boolean |
copyFile(WritableStorageFactory storageFactory,
java.io.File from,
StorageFile to) |
static boolean |
copyFile(WritableStorageFactory storageFactory,
java.io.File from,
StorageFile to,
byte[] buf) |
static boolean |
copyFile(WritableStorageFactory storageFactory,
StorageFile from,
StorageFile to) |
static boolean |
copyFile(WritableStorageFactory storageFactory,
StorageFile from,
StorageFile to,
byte[] buf) |
static java.io.File |
getAbsoluteFile(java.io.File root,
java.lang.String path)
Convert a file path into a File object with an absolute path
relative to a passed in root.
|
static void |
limitAccessToOwner(java.io.File file)
Use when creating new files.
|
private static boolean |
limitAccessToOwnerViaACLs(java.io.File file) |
static java.io.File |
newFile(java.io.File parent,
java.lang.String name)
A replacement for new File(File, String) that correctly implements
the case when the first argument is null.
|
static boolean |
removeDirectory(java.io.File directory)
Remove a directory and all of its contents.
|
static boolean |
removeDirectory(java.lang.String directory) |
static java.lang.String |
stripProtocolFromFileName(java.lang.String originalName)
Remove the leading 'file://' protocol from a filename which has been
expressed as an URL.
|
private static final int BUFFER_SIZE
private static final java.lang.Object region
private static boolean initialized
private static java.lang.reflect.Method setWrite
private static java.lang.reflect.Method setRead
private static java.lang.reflect.Method setExec
private static java.lang.Class fileClz
private static java.lang.Class filesClz
private static java.lang.Class pathClz
private static java.lang.Class pathsClz
private static java.lang.Class aclEntryClz
private static java.lang.Class aclFileAttributeViewClz
private static java.lang.Class posixFileAttributeViewClz
private static java.lang.Class userPrincipalClz
private static java.lang.Class linkOptionArrayClz
private static java.lang.Class linkOptionClz
private static java.lang.Class stringArrayClz
private static java.lang.Class aclEntryBuilderClz
private static java.lang.Class aclEntryTypeClz
private static java.lang.Class fileStoreClz
private static java.lang.Class aclEntryPermissionClz
private static java.lang.reflect.Method get
private static java.lang.reflect.Method getFileAttributeView
private static java.lang.reflect.Method supportsFileAttributeView
private static java.lang.reflect.Method getFileStore
private static java.lang.reflect.Method getOwner
private static java.lang.reflect.Method getAcl
private static java.lang.reflect.Method setAcl
private static java.lang.reflect.Method principal
private static java.lang.reflect.Method getName
private static java.lang.reflect.Method build
private static java.lang.reflect.Method newBuilder
private static java.lang.reflect.Method setPrincipal
private static java.lang.reflect.Method setType
private static java.lang.reflect.Method values
private static java.lang.reflect.Method setPermissions
private static java.lang.reflect.Field allow
public static boolean removeDirectory(java.io.File directory)
public static boolean removeDirectory(java.lang.String directory)
public static boolean copyDirectory(java.io.File from, java.io.File to)
public static boolean copyDirectory(java.lang.String from, java.lang.String to)
public static boolean copyDirectory(java.io.File from, java.io.File to, byte[] buffer, java.lang.String[] filter)
filter
- - array of names to not copy.public static boolean copyFile(java.io.File from, java.io.File to, byte[] buf)
public static boolean copyDirectory(StorageFactory storageFactory, StorageFile from, java.io.File to, byte[] buffer, java.lang.String[] filter, boolean copySubDirs)
public static boolean copyFile(StorageFactory storageFactory, StorageFile from, java.io.File to)
public static boolean copyFile(StorageFactory storageFactory, StorageFile from, java.io.File to, byte[] buf)
public static boolean copyDirectory(WritableStorageFactory storageFactory, java.io.File from, StorageFile to)
public static boolean copyDirectory(WritableStorageFactory storageFactory, java.io.File from, StorageFile to, byte[] buffer, java.lang.String[] filter)
public static boolean copyFile(WritableStorageFactory storageFactory, java.io.File from, StorageFile to)
public static boolean copyFile(WritableStorageFactory storageFactory, java.io.File from, StorageFile to, byte[] buf)
public static boolean copyFile(WritableStorageFactory storageFactory, StorageFile from, StorageFile to)
public static boolean copyFile(WritableStorageFactory storageFactory, StorageFile from, StorageFile to, byte[] buf)
public static java.io.File getAbsoluteFile(java.io.File root, java.lang.String path)
public static java.io.File newFile(java.io.File parent, java.lang.String name)
public static java.lang.String stripProtocolFromFileName(java.lang.String originalName)
public static void limitAccessToOwner(java.io.File file)
file
to owner if derby.storage.useDefaultFilePermissions == false
.
If the property is not specified, we use restrictive permissions anyway
iff running with the server server started from the command line.
On Unix, this is equivalent to running with umask 0077.
On Windows, with FAT/FAT32, we lose, since the fs does not support
permissions, only a read-only flag.
On Windows, with NTFS with ACLs, if running with Java 7 or higher, we
limit access also for Windows using the new java.nio.file.attribute
package.file
- assumed to be just createdprivate static void assertTrue(java.lang.Object r)
private static boolean limitAccessToOwnerViaACLs(java.io.File file)
Apache Derby V10.10 Internals - Copyright © 2004,2013 The Apache Software Foundation. All Rights Reserved.