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 classGridFile.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)booleancanExecute()booleancanRead()booleancanWrite()protected booleancheckParentDirs(String path, boolean createIfAbsent)Checks whether the parent directories are present (and are directories).intcompareTo(File file)booleancreateNewFile()booleandelete()voiddeleteOnExit()booleanequals(Object obj)booleanexists()protected static Stringfilename(String fullPath)FilegetAbsoluteFile()StringgetAbsolutePath()FilegetCanonicalFile()StringgetCanonicalPath()intgetChunkSize()Guaranteed to be a power of twolonggetFreeSpace()StringgetName()StringgetParent()FilegetParentFile()StringgetPath()Returns path of this file.longgetTotalSpace()longgetUsableSpace()inthashCode()protected voidinitChunkSizeFromMetadata()booleanisAbsolute()protected static booleanisChildOf(String parent, String child)Verifies whether child is a child (dir or file) of parentbooleanisDirectory()booleanisFile()booleanisHidden()longlastModified()longlength()String[]list()String[]list(FilenameFilter filter)File[]listFiles()File[]listFiles(FileFilter filter)File[]listFiles(FilenameFilter filter)booleanmkdir()booleanmkdirs()booleanrenameTo(File dest)booleansetExecutable(boolean executable)booleansetExecutable(boolean executable, boolean ownerOnly)booleansetLastModified(long time)booleansetReadable(boolean readable)booleansetReadable(boolean readable, boolean ownerOnly)booleansetReadOnly()booleansetWritable(boolean writable)booleansetWritable(boolean writable, boolean ownerOnly)StringtoString()URItoURI()URLtoURL()-
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:
getAbsolutePathin classFile
-
getAbsoluteFile
public File getAbsoluteFile()
- Overrides:
getAbsoluteFilein classFile
-
getCanonicalPath
public String getCanonicalPath() throws IOException
- Overrides:
getCanonicalPathin classFile- Throws:
IOException
-
getCanonicalFile
public File getCanonicalFile() throws IOException
- Overrides:
getCanonicalFilein classFile- Throws:
IOException
-
isAbsolute
public boolean isAbsolute()
- Overrides:
isAbsolutein classFile
-
deleteOnExit
public void deleteOnExit()
- Overrides:
deleteOnExitin classFile
-
getChunkSize
public int getChunkSize()
Guaranteed to be a power of two
-
createNewFile
public boolean createNewFile() throws IOException- Overrides:
createNewFilein classFile- Throws:
IOException
-
getParentFile
public File getParentFile()
- Overrides:
getParentFilein classFile
-
lastModified
public long lastModified()
- Overrides:
lastModifiedin classFile
-
setLastModified
public boolean setLastModified(long time)
- Overrides:
setLastModifiedin classFile
-
list
public String[] list(FilenameFilter filter)
-
listFiles
public File[] listFiles(FilenameFilter filter)
-
listFiles
public File[] listFiles(FileFilter filter)
-
isDirectory
public boolean isDirectory()
- Overrides:
isDirectoryin 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:
canExecutein classFile
-
compareTo
public int compareTo(File file)
- Specified by:
compareToin interfaceComparable<File>- Overrides:
compareToin classFile
-
toURL
public URL toURL() throws MalformedURLException
- Overrides:
toURLin classFile- Throws:
MalformedURLException
-
setReadOnly
public boolean setReadOnly()
- Overrides:
setReadOnlyin classFile
-
setWritable
public boolean setWritable(boolean writable, boolean ownerOnly)- Overrides:
setWritablein classFile
-
setWritable
public boolean setWritable(boolean writable)
- Overrides:
setWritablein classFile
-
setReadable
public boolean setReadable(boolean readable, boolean ownerOnly)- Overrides:
setReadablein classFile
-
setReadable
public boolean setReadable(boolean readable)
- Overrides:
setReadablein classFile
-
setExecutable
public boolean setExecutable(boolean executable, boolean ownerOnly)- Overrides:
setExecutablein classFile
-
setExecutable
public boolean setExecutable(boolean executable)
- Overrides:
setExecutablein classFile
-
getTotalSpace
public long getTotalSpace()
- Overrides:
getTotalSpacein classFile
-
getFreeSpace
public long getFreeSpace()
- Overrides:
getFreeSpacein classFile
-
getUsableSpace
public long getUsableSpace()
- Overrides:
getUsableSpacein classFile
-
-