Package org.infinispan.io
Class GridFile
- java.lang.Object
-
- java.io.File
-
- org.infinispan.io.GridFile
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<java.io.File>
public class GridFile extends java.io.FileSubclass 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
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String[]_list(java.lang.Object filter)protected java.io.File[]_listFiles(java.lang.Object filter)booleancanExecute()booleancanRead()booleancanWrite()protected booleancheckParentDirs(java.lang.String path, boolean createIfAbsent)Checks whether the parent directories are present (and are directories).intcompareTo(java.io.File file)booleancreateNewFile()booleandelete()voiddeleteOnExit()booleanequals(java.lang.Object obj)booleanexists()protected static java.lang.Stringfilename(java.lang.String fullPath)java.io.FilegetAbsoluteFile()java.lang.StringgetAbsolutePath()java.io.FilegetCanonicalFile()java.lang.StringgetCanonicalPath()intgetChunkSize()Guaranteed to be a power of twolonggetFreeSpace()java.lang.StringgetName()java.lang.StringgetParent()java.io.FilegetParentFile()java.lang.StringgetPath()Returns path of this file.longgetTotalSpace()longgetUsableSpace()inthashCode()protected voidinitChunkSizeFromMetadata()booleanisAbsolute()protected static booleanisChildOf(java.lang.String parent, java.lang.String child)Verifies whether child is a child (dir or file) of parentbooleanisDirectory()booleanisFile()booleanisHidden()longlastModified()longlength()java.lang.String[]list()java.lang.String[]list(java.io.FilenameFilter filter)java.io.File[]listFiles()java.io.File[]listFiles(java.io.FileFilter filter)java.io.File[]listFiles(java.io.FilenameFilter filter)booleanmkdir()booleanmkdirs()booleanrenameTo(java.io.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)java.lang.StringtoString()java.net.URItoURI()java.net.URLtoURL()
-
-
-
Method Detail
-
getName
public java.lang.String getName()
- Overrides:
getNamein classjava.io.File
-
getPath
public java.lang.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.- Overrides:
getPathin classjava.io.File- Returns:
- String containing path of file.
-
getAbsolutePath
public java.lang.String getAbsolutePath()
- Overrides:
getAbsolutePathin classjava.io.File
-
getAbsoluteFile
public java.io.File getAbsoluteFile()
- Overrides:
getAbsoluteFilein classjava.io.File
-
getCanonicalPath
public java.lang.String getCanonicalPath() throws java.io.IOException- Overrides:
getCanonicalPathin classjava.io.File- Throws:
java.io.IOException
-
getCanonicalFile
public java.io.File getCanonicalFile() throws java.io.IOException- Overrides:
getCanonicalFilein classjava.io.File- Throws:
java.io.IOException
-
isAbsolute
public boolean isAbsolute()
- Overrides:
isAbsolutein classjava.io.File
-
renameTo
public boolean renameTo(java.io.File dest)
- Overrides:
renameToin classjava.io.File
-
deleteOnExit
public void deleteOnExit()
- Overrides:
deleteOnExitin classjava.io.File
-
length
public long length()
- Overrides:
lengthin classjava.io.File
-
getChunkSize
public int getChunkSize()
Guaranteed to be a power of two
-
createNewFile
public boolean createNewFile() throws java.io.IOException- Overrides:
createNewFilein classjava.io.File- Throws:
java.io.IOException
-
delete
public boolean delete()
- Overrides:
deletein classjava.io.File
-
mkdir
public boolean mkdir()
- Overrides:
mkdirin classjava.io.File
-
mkdirs
public boolean mkdirs()
- Overrides:
mkdirsin classjava.io.File
-
exists
public boolean exists()
- Overrides:
existsin classjava.io.File
-
getParent
public java.lang.String getParent()
- Overrides:
getParentin classjava.io.File
-
getParentFile
public java.io.File getParentFile()
- Overrides:
getParentFilein classjava.io.File
-
lastModified
public long lastModified()
- Overrides:
lastModifiedin classjava.io.File
-
setLastModified
public boolean setLastModified(long time)
- Overrides:
setLastModifiedin classjava.io.File
-
list
public java.lang.String[] list()
- Overrides:
listin classjava.io.File
-
list
public java.lang.String[] list(java.io.FilenameFilter filter)
- Overrides:
listin classjava.io.File
-
listFiles
public java.io.File[] listFiles()
- Overrides:
listFilesin classjava.io.File
-
listFiles
public java.io.File[] listFiles(java.io.FilenameFilter filter)
- Overrides:
listFilesin classjava.io.File
-
listFiles
public java.io.File[] listFiles(java.io.FileFilter filter)
- Overrides:
listFilesin classjava.io.File
-
isDirectory
public boolean isDirectory()
- Overrides:
isDirectoryin classjava.io.File
-
isFile
public boolean isFile()
- Overrides:
isFilein classjava.io.File
-
initChunkSizeFromMetadata
protected void initChunkSizeFromMetadata()
-
_listFiles
protected java.io.File[] _listFiles(java.lang.Object filter)
-
_list
protected java.lang.String[] _list(java.lang.Object filter)
-
isChildOf
protected static boolean isChildOf(java.lang.String parent, java.lang.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
-
filename
protected static java.lang.String filename(java.lang.String fullPath)
-
checkParentDirs
protected boolean checkParentDirs(java.lang.String path, boolean createIfAbsent) throws java.io.IOExceptionChecks whether the parent directories are present (and are directories). If createIfAbsent is true, creates missing dirs- Parameters:
path-createIfAbsent-- Returns:
- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.io.File
-
canRead
public boolean canRead()
- Overrides:
canReadin classjava.io.File
-
canWrite
public boolean canWrite()
- Overrides:
canWritein classjava.io.File
-
isHidden
public boolean isHidden()
- Overrides:
isHiddenin classjava.io.File
-
canExecute
public boolean canExecute()
- Overrides:
canExecutein classjava.io.File
-
compareTo
public int compareTo(java.io.File file)
- Specified by:
compareToin interfacejava.lang.Comparable<java.io.File>- Overrides:
compareToin classjava.io.File
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.io.File
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.io.File
-
toURL
public java.net.URL toURL() throws java.net.MalformedURLException- Overrides:
toURLin classjava.io.File- Throws:
java.net.MalformedURLException
-
toURI
public java.net.URI toURI()
- Overrides:
toURIin classjava.io.File
-
setReadOnly
public boolean setReadOnly()
- Overrides:
setReadOnlyin classjava.io.File
-
setWritable
public boolean setWritable(boolean writable, boolean ownerOnly)- Overrides:
setWritablein classjava.io.File
-
setWritable
public boolean setWritable(boolean writable)
- Overrides:
setWritablein classjava.io.File
-
setReadable
public boolean setReadable(boolean readable, boolean ownerOnly)- Overrides:
setReadablein classjava.io.File
-
setReadable
public boolean setReadable(boolean readable)
- Overrides:
setReadablein classjava.io.File
-
setExecutable
public boolean setExecutable(boolean executable, boolean ownerOnly)- Overrides:
setExecutablein classjava.io.File
-
setExecutable
public boolean setExecutable(boolean executable)
- Overrides:
setExecutablein classjava.io.File
-
getTotalSpace
public long getTotalSpace()
- Overrides:
getTotalSpacein classjava.io.File
-
getFreeSpace
public long getFreeSpace()
- Overrides:
getFreeSpacein classjava.io.File
-
getUsableSpace
public long getUsableSpace()
- Overrides:
getUsableSpacein classjava.io.File
-
-