Package org.jgroups.blocks
Class GridFile
- java.lang.Object
-
- java.io.File
-
- org.jgroups.blocks.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- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGridFile.Metadata
-
Field Summary
Fields Modifier and Type Field Description private ReplCache<java.lang.String,GridFile.Metadata>cacheprivate intchunk_sizeprivate GridFilesystemfsprivate java.lang.Stringnameprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description GridFile(java.io.File parent, java.lang.String child, ReplCache<java.lang.String,GridFile.Metadata> cache, int chunk_size, GridFilesystem fs)GridFile(java.lang.String parent, java.lang.String child, ReplCache<java.lang.String,GridFile.Metadata> cache, int chunk_size, GridFilesystem fs)GridFile(java.lang.String pathname, ReplCache<java.lang.String,GridFile.Metadata> cache, int chunk_size, GridFilesystem fs)
-
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)protected booleancheckParentDirs(java.lang.String path, boolean create_if_absent)Checks whether the parent directories are present (and are directories).booleancreateNewFile()booleandelete()booleandelete(boolean synchronous)booleanexists()private booleanexists(java.lang.String key)protected static java.lang.Stringfilename(java.lang.String full_path)intgetChunkSize()java.lang.StringgetName()java.lang.StringgetPath()protected voidinitMetadata()protected static booleanisChildOf(java.lang.String parent, java.lang.String child)Verifies whether child is a child (dir or file) of parentbooleanisDirectory()booleanisFile()private booleanisFile(java.lang.String key)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()(package private) voidsetLength(int new_length)protected static java.lang.Stringtrim(java.lang.String str)-
Methods inherited from class java.io.File
canExecute, canRead, canWrite, compareTo, createTempFile, createTempFile, deleteOnExit, equals, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getParent, getParentFile, getTotalSpace, getUsableSpace, hashCode, isAbsolute, isHidden, lastModified, listRoots, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toString, toURI, toURL
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
cache
private final ReplCache<java.lang.String,GridFile.Metadata> cache
-
fs
private final GridFilesystem fs
-
name
private final java.lang.String name
-
chunk_size
private int chunk_size
-
-
Constructor Detail
-
GridFile
GridFile(java.lang.String pathname, ReplCache<java.lang.String,GridFile.Metadata> cache, int chunk_size, GridFilesystem fs)
-
GridFile
GridFile(java.lang.String parent, java.lang.String child, ReplCache<java.lang.String,GridFile.Metadata> cache, int chunk_size, GridFilesystem fs)
-
GridFile
GridFile(java.io.File parent, java.lang.String child, ReplCache<java.lang.String,GridFile.Metadata> cache, int chunk_size, GridFilesystem fs)
-
-
Method Detail
-
getName
public java.lang.String getName()
- Overrides:
getNamein classjava.io.File
-
getPath
public java.lang.String getPath()
- Overrides:
getPathin classjava.io.File
-
length
public long length()
- Overrides:
lengthin classjava.io.File
-
setLength
void setLength(int new_length)
-
getChunkSize
public int getChunkSize()
-
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
-
delete
public boolean delete(boolean synchronous)
-
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
-
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
-
initMetadata
protected void initMetadata()
-
_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 full_path)
-
checkParentDirs
protected boolean checkParentDirs(java.lang.String path, boolean create_if_absent) throws java.io.IOExceptionChecks whether the parent directories are present (and are directories). If create_if_absent is true, creates missing dirs- Parameters:
path-create_if_absent-- Returns:
- Throws:
java.io.IOException
-
trim
protected static java.lang.String trim(java.lang.String str)
-
exists
private boolean exists(java.lang.String key)
-
isFile
private boolean isFile(java.lang.String key)
-
-