FileStatus (Hadoop 1.2.1 API)
Date: 2013-07-22

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.fs
Class FileStatus

    java.lang.Object
      org.apache.hadoop.fs.FileStatus

All Implemented Interfaces:
  Comparable, Writable

    public class FileStatus

extends Object
implements Writable, Comparable

Interface that represents the client side information for a file.

Constructor Summary
`FileStatus()`
`FileStatus(long length, boolean isdir, int block_replication, long blocksize, long modification_time, long access_time, FsPermission permission, String owner, String group, Path path)`
`FileStatus(long length, boolean isdir, int block_replication, long blocksize, long modification_time, Path path)`

Method Summary
`int` | `compareTo(Object o)` Compare this object to another object
`boolean` | `equals(Object o)` Compare if this object is equal to another object
`long` | `getAccessTime()` Get the access time of the file.
`long` | `getBlockSize()` Get the block size of the file.
`String` | `getGroup()` Get the group associated with the file.
`long` | `getLen()`
`long` | `getModificationTime()` Get the modification time of the file.
`String` | `getOwner()` Get the owner of the file.
`Path` | `getPath()`
`FsPermission` | `getPermission()` Get FsPermission associated with the file.
`short` | `getReplication()` Get the replication factor of a file.
`int` | `hashCode()` Returns a hash code value for the object, which is defined as the hash code of the path name.
`boolean` | `isDir()` Is this a directory?
`void` | `readFields(DataInput in)` Deserialize the fields of this object from `in`.
`protected void` | `setGroup(String group)` Sets group.
`protected void` | `setOwner(String owner)` Sets owner.
`protected void` | `setPermission(FsPermission permission)` Sets permission.
`void` | `write(DataOutput out)` Serialize the fields of this object to `out`.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### FileStatus

    public FileStatus()

### FileStatus

    public FileStatus(long length,
                      boolean isdir,
                      int block_replication,
                      long blocksize,
                      long modification_time,
                      Path path)

### FileStatus

    public FileStatus(long length,
                      boolean isdir,
                      int block_replication,
                      long blocksize,
                      long modification_time,
                      long access_time,
                      FsPermission permission,
                      String owner,
                      String group,
                      Path path)

Method Detail

### getLen

    public long getLen()

### isDir

    public boolean isDir()

  Is this a directory?

  Returns:
    true if this is a directory

### getBlockSize

    public long getBlockSize()

  Get the block size of the file.

  Returns:
    the number of bytes

### getReplication

    public short getReplication()

  Get the replication factor of a file.

  Returns:
    the replication factor of a file.

### getModificationTime

    public long getModificationTime()

  Get the modification time of the file.

  Returns:
    the modification time of file in milliseconds since January 1, 1970 UTC.

### getAccessTime

    public long getAccessTime()

  Get the access time of the file.

  Returns:
    the access time of file in milliseconds since January 1, 1970 UTC.

### getPermission

    public FsPermission getPermission()

  Get FsPermission associated with the file.

  Returns:
    permssion. If a filesystem does not have a notion of permissions or if permissions could not be determined, then default permissions equivalent of "rwxrwxrwx" is returned.

### getOwner

    public String getOwner()

  Get the owner of the file.

  Returns:
    owner of the file. The string could be empty if there is no notion of owner of a file in a filesystem or if it could not be determined (rare).

### getGroup

    public String getGroup()

  Get the group associated with the file.

  Returns:
    group for the file. The string could be empty if there is no notion of group of a file in a filesystem or if it could not be determined (rare).

### getPath

    public Path getPath()

### setPermission

    protected void setPermission(FsPermission permission)

  Sets permission.

  Parameters:
    `permission` - if permission is null, default value is set

### setOwner

    protected void setOwner(String owner)

  Sets owner.

  Parameters:
    `owner` - if it is null, default value is set

### setGroup

    protected void setGroup(String group)

  Sets group.

  Parameters:
    `group` - if it is null, default value is set

### write

    public void write(DataOutput out)
               throws IOException

  Description copied from interface: `Writable`
  Serialize the fields of this object to `out`.

  Specified by:
    `write` in interface `Writable`
  Parameters:
    `out` - `DataOuput` to serialize this object into.
  Throws:
    `IOException`

### readFields

    public void readFields(DataInput in)
                    throws IOException

  Description copied from interface: `Writable`
  Deserialize the fields of this object from `in`.

  For efficiency, implementations should attempt to re-use storage in the existing object where possible.

  Specified by:
    `readFields` in interface `Writable`
  Parameters:
    `in` - `DataInput` to deseriablize this object from.
  Throws:
    `IOException`

### compareTo

    public int compareTo(Object o)

  Compare this object to another object

  Specified by:
    `compareTo` in interface `Comparable`
  Parameters:
    `o` - the object to be compared.
  Returns:
    a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
  Throws:
    `ClassCastException` - if the specified object's is not of type FileStatus

### equals

    public boolean equals(Object o)

  Compare if this object is equal to another object

  Overrides:
    `equals` in class `Object`
  Parameters:
    `o` - the object to be compared.
  Returns:
    true if two file status has the same path name; false if not.

### hashCode

    public int hashCode()

  Returns a hash code value for the object, which is defined as the hash code of the path name.

  Overrides:
    `hashCode` in class `Object`
  Returns:
    a hash code value for the path name.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation