public abstract class Inode extends ImageWriter implements Comparable<Inode>
Inode
is an abstract class, with information shared by all types of Inodes.Modifier and Type | Field and Description |
---|---|
protected boolean |
mIsFolder |
Modifier | Constructor and Description |
---|---|
protected |
Inode(String name,
int id,
int parentId,
boolean isFolder,
long creationTimeMs)
Create an inode.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Inode o) |
boolean |
equals(Object o) |
abstract ClientFileInfo |
generateClientFileInfo(String path)
Generate a ClientFileInfo of the file or folder.
|
long |
getCreationTimeMs()
Get the create time of the inode.
|
int |
getId()
Get the id of the inode
|
long |
getLastModificationTimeMs()
Get the last modification time of the inode
|
String |
getName()
Get the name of the inode
|
int |
getParentId()
Get the id of the parent folder
|
int |
hashCode() |
boolean |
isDirectory()
Return whether the inode is a directory or not
|
boolean |
isFile()
Return whether the inode is a file or not
|
boolean |
isPinned()
Get the pinned flag of the inode
|
void |
reverseId()
Reverse the id of the inode.
|
void |
setLastModificationTimeMs(long lastModificationTimeMs)
Set the last modification time of the inode
|
void |
setName(String name)
Set the name of the inode
|
void |
setParentId(int parentId)
Set the parent folder of the inode
|
void |
setPinned(boolean pinned)
Set the pinned flag of the inode
|
String |
toString() |
writeElement
protected Inode(String name, int id, int parentId, boolean isFolder, long creationTimeMs)
name
- the name of the inode.id
- the id of the inode, which is globaly unique.parentId
- the parent of the inode. -1 if there is no parent.isFolder
- if the inode presents a foldercreationTimeMs
- the creation time of the inode.public int compareTo(Inode o)
compareTo
in interface Comparable<Inode>
public abstract ClientFileInfo generateClientFileInfo(String path)
path
- The path of the filepublic long getCreationTimeMs()
public int getId()
public String getName()
public int getParentId()
public boolean isPinned()
public long getLastModificationTimeMs()
public boolean isDirectory()
public boolean isFile()
public void reverseId()
public void setName(String name)
name
- The new name of the inodepublic void setParentId(int parentId)
parentId
- The new parentpublic void setPinned(boolean pinned)
pinned
- If true, the inode need pinned, and a pinned file is never evicted from memorypublic void setLastModificationTimeMs(long lastModificationTimeMs)
lastModificationTimeMs
- The last modification time, in millisecondsCopyright © 2015. All Rights Reserved.