Package org.infinispan.io
Class GridFile
- java.lang.Object
-
- java.io.File
-
- org.infinispan.io.GridFile
-
- All Implemented Interfaces:
Serializable
,Comparable<File>
public class GridFile extends File
Subclass of File to iterate through directories and files in a grid- Author:
- Bela Ban, Marko Luksa
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GridFile.Metadata
-
Field Summary
-
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String[]
_list(Object filter)
protected File[]
_listFiles(Object filter)
boolean
canExecute()
boolean
canRead()
boolean
canWrite()
protected boolean
checkParentDirs(String path, boolean createIfAbsent)
Checks whether the parent directories are present (and are directories).int
compareTo(File file)
boolean
createNewFile()
boolean
delete()
void
deleteOnExit()
boolean
equals(Object obj)
boolean
exists()
protected static String
filename(String fullPath)
File
getAbsoluteFile()
String
getAbsolutePath()
File
getCanonicalFile()
String
getCanonicalPath()
int
getChunkSize()
Guaranteed to be a power of twolong
getFreeSpace()
String
getName()
String
getParent()
File
getParentFile()
String
getPath()
Returns path of this file.long
getTotalSpace()
long
getUsableSpace()
int
hashCode()
protected void
initChunkSizeFromMetadata()
boolean
isAbsolute()
protected static boolean
isChildOf(String parent, String child)
Verifies whether child is a child (dir or file) of parentboolean
isDirectory()
boolean
isFile()
boolean
isHidden()
long
lastModified()
long
length()
String[]
list()
String[]
list(FilenameFilter filter)
File[]
listFiles()
File[]
listFiles(FileFilter filter)
File[]
listFiles(FilenameFilter filter)
boolean
mkdir()
boolean
mkdirs()
boolean
renameTo(File dest)
boolean
setExecutable(boolean executable)
boolean
setExecutable(boolean executable, boolean ownerOnly)
boolean
setLastModified(long time)
boolean
setReadable(boolean readable)
boolean
setReadable(boolean readable, boolean ownerOnly)
boolean
setReadOnly()
boolean
setWritable(boolean writable)
boolean
setWritable(boolean writable, boolean ownerOnly)
String
toString()
URI
toURI()
URL
toURL()
-
Methods inherited from class java.io.File
createTempFile, createTempFile, listRoots, toPath
-
-
-
-
Method Detail
-
getPath
public String getPath()
Returns path of this file. To avoid issues arising from file separator differences between different operative systems, the path returned always uses Unix-like path separator, '/' character. Any client code calling this method should bear that if disecting the path.
-
getAbsolutePath
public String getAbsolutePath()
- Overrides:
getAbsolutePath
in classFile
-
getAbsoluteFile
public File getAbsoluteFile()
- Overrides:
getAbsoluteFile
in classFile
-
getCanonicalPath
public String getCanonicalPath() throws IOException
- Overrides:
getCanonicalPath
in classFile
- Throws:
IOException
-
getCanonicalFile
public File getCanonicalFile() throws IOException
- Overrides:
getCanonicalFile
in classFile
- Throws:
IOException
-
isAbsolute
public boolean isAbsolute()
- Overrides:
isAbsolute
in classFile
-
deleteOnExit
public void deleteOnExit()
- Overrides:
deleteOnExit
in classFile
-
getChunkSize
public int getChunkSize()
Guaranteed to be a power of two
-
createNewFile
public boolean createNewFile() throws IOException
- Overrides:
createNewFile
in classFile
- Throws:
IOException
-
getParentFile
public File getParentFile()
- Overrides:
getParentFile
in classFile
-
lastModified
public long lastModified()
- Overrides:
lastModified
in classFile
-
setLastModified
public boolean setLastModified(long time)
- Overrides:
setLastModified
in classFile
-
list
public String[] list(FilenameFilter filter)
-
listFiles
public File[] listFiles(FilenameFilter filter)
-
listFiles
public File[] listFiles(FileFilter filter)
-
isDirectory
public boolean isDirectory()
- Overrides:
isDirectory
in classFile
-
initChunkSizeFromMetadata
protected void initChunkSizeFromMetadata()
-
isChildOf
protected static boolean isChildOf(String parent, String child)
Verifies whether child is a child (dir or file) of parent- Parameters:
parent
-child
-- Returns:
- True if child is a child, false otherwise
-
checkParentDirs
protected boolean checkParentDirs(String path, boolean createIfAbsent) throws IOException
Checks whether the parent directories are present (and are directories). If createIfAbsent is true, creates missing dirs- Parameters:
path
-createIfAbsent
-- Returns:
- Throws:
IOException
-
canExecute
public boolean canExecute()
- Overrides:
canExecute
in classFile
-
compareTo
public int compareTo(File file)
- Specified by:
compareTo
in interfaceComparable<File>
- Overrides:
compareTo
in classFile
-
toURL
public URL toURL() throws MalformedURLException
- Overrides:
toURL
in classFile
- Throws:
MalformedURLException
-
setReadOnly
public boolean setReadOnly()
- Overrides:
setReadOnly
in classFile
-
setWritable
public boolean setWritable(boolean writable, boolean ownerOnly)
- Overrides:
setWritable
in classFile
-
setWritable
public boolean setWritable(boolean writable)
- Overrides:
setWritable
in classFile
-
setReadable
public boolean setReadable(boolean readable, boolean ownerOnly)
- Overrides:
setReadable
in classFile
-
setReadable
public boolean setReadable(boolean readable)
- Overrides:
setReadable
in classFile
-
setExecutable
public boolean setExecutable(boolean executable, boolean ownerOnly)
- Overrides:
setExecutable
in classFile
-
setExecutable
public boolean setExecutable(boolean executable)
- Overrides:
setExecutable
in classFile
-
getTotalSpace
public long getTotalSpace()
- Overrides:
getTotalSpace
in classFile
-
getFreeSpace
public long getFreeSpace()
- Overrides:
getFreeSpace
in classFile
-
getUsableSpace
public long getUsableSpace()
- Overrides:
getUsableSpace
in classFile
-
-