tikhomirov@287: /* tikhomirov@413: * Copyright (c) 2011-2012 TMate Software Ltd tikhomirov@287: * tikhomirov@287: * This program is free software; you can redistribute it and/or modify tikhomirov@287: * it under the terms of the GNU General Public License as published by tikhomirov@287: * the Free Software Foundation; version 2 of the License. tikhomirov@287: * tikhomirov@287: * This program is distributed in the hope that it will be useful, tikhomirov@287: * but WITHOUT ANY WARRANTY; without even the implied warranty of tikhomirov@287: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the tikhomirov@287: * GNU General Public License for more details. tikhomirov@287: * tikhomirov@287: * For information on how to redistribute this software under tikhomirov@287: * the terms of a license other than GNU General Public License tikhomirov@287: * contact TMate Software at support@hg4j.com tikhomirov@287: */ tikhomirov@287: package org.tmatesoft.hg.util; tikhomirov@287: tikhomirov@287: import java.nio.channels.ReadableByteChannel; tikhomirov@287: tikhomirov@287: /** tikhomirov@287: * Subset of File-related functionality to support other than {@link java.io.File}-based {@link FileIterator} implementations tikhomirov@287: * tikhomirov@287: * @author Artem Tikhomirov tikhomirov@287: * @author TMate Software Ltd. tikhomirov@287: */ tikhomirov@287: public interface FileInfo { tikhomirov@287: tikhomirov@287: /** tikhomirov@287: * @return true if the filesystem object described by this instance exists, is a regular file and can be read tikhomirov@287: */ tikhomirov@287: boolean exists(); tikhomirov@287: tikhomirov@287: /** tikhomirov@287: * File last modification time, in seconds since Jan 1, 1970. E.g. {@link java.io.File#lastModified()} / 1000 tikhomirov@287: * @return int value representing time, in seconds, when file was last modified. tikhomirov@287: */ tikhomirov@287: int lastModified(); tikhomirov@287: tikhomirov@287: /** tikhomirov@287: * @return file size tikhomirov@287: */ tikhomirov@287: long length(); tikhomirov@287: tikhomirov@287: /** tikhomirov@287: * Access file contents. Caller is responsible to close the channel. tikhomirov@287: * @return file reader object, never null tikhomirov@287: */ tikhomirov@287: ReadableByteChannel newInputChannel(); tikhomirov@413: tikhomirov@413: /** tikhomirov@413: * This method is invoked only if source FileIterator tells true for {@link FileIterator#supportsExecFlag()} tikhomirov@413: * @return true if this object describes an executable file tikhomirov@413: */ tikhomirov@413: boolean isExecutable(); tikhomirov@413: tikhomirov@413: /** tikhomirov@413: * This method is be invoked only if source FileIterator tells true for {@link FileIterator#supportsLinkFlag()}. tikhomirov@413: * @return true if this file object represents a symbolic link tikhomirov@413: */ tikhomirov@413: boolean isSymlink(); tikhomirov@287: }