![JAR search and dependency download from the Maven repository](/logo.png)
net.sourceforge.javadpkg.io.FileMetaData Maven / Gradle / Ivy
/*
* dpkg - Debian Package library and the Debian Package Maven plugin
* (c) Copyright 2016 Gerrit Hohl
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package net.sourceforge.javadpkg.io;
import java.util.Date;
/**
*
* The meta data of a file or directory.
*
*
* @author Gerrit Hohl ([email protected])
* @version 1.0, 12.05.2016 by Gerrit Hohl
*/
public interface FileMetaData {
/**
*
* Returns the path of the file excluding the name.
*
*
* @return The path.
* @see #getName()
* @see #getAbsolutePath()
*/
String getPath();
/**
*
* Returns the name of the file.
*
*
* @return The name.
* @see #getPath()
* @see #getAbsolutePath()
*/
String getName();
/**
*
* Returns the absolute path consisting of the path and the name of the
* file.
*
*
* If the file is a directory a trailing slash will be added.
*
*
* @return The absolute path.
* @see #getPath()
* @see #getName()
*/
String getAbsolutePath();
/**
*
* Returns the flag if the file is a regular file.
*
*
* A symbolic link is also a file.
*
*
* @return The flag: true
, if the file is a regular file,
* false
otherwise.
* @see #isDirectory()
* @see #isSymbolicLink()
*/
boolean isFile();
/**
*
* Returns the flag if the file is a directory.
*
*
* @return The flag: true
, if the file is a directory,
* false
otherwise.
* @see #isFile()
*/
boolean isDirectory();
/**
*
* Returns the flag if the file is a symbolic link.
*
*
* @return The flag: true
, if the file is a symbolic link,
* false
otherwise.
* @see #isFile()
* @see #getTargetPath()
*/
boolean isSymbolicLink();
/**
*
* Returns the target path of the symbolic link.
*
*
* @return The target path or null
, if this meta data does not
* represent a symbolic link.
* @see #isSymbolicLink()
*/
String getTargetPath();
/**
*
* Returns the owner of the file.
*
*
* @return The owner.
*/
FileOwner getOwner();
/**
*
* Returns the mode of the file.
*
*
* @return The mode.
*/
FileMode getMode();
/**
*
* Returns the textual representation of the mode including the directory
* flag.
*
*
* The returned value may look like this:
* drwxrwxrwx
or like this:
* ----------
*
*
* @return The mode.
* @see FileMode#getText()
*/
String getModeAsText();
/**
*
* Returns the of the file in bytes.
*
*
* @return The length or -1
, if the length is unknown or the
* file is not a regular file.
*/
long getLength();
/**
*
* Returns the timestamp of the last modification.
*
*
* @return The timestamp.
*/
Date getLastModifiedDate();
}