Mercurial > hg4j
comparison src/org/tmatesoft/hg/util/FileInfo.java @ 287:ed6b74a58c66
Use FileInfo abstraction with necessary subset of File functionality instead of File to facilitate other effective file system iterators
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 07 Sep 2011 09:33:27 +0200 |
parents | |
children | 7f27122011c3 |
comparison
equal
deleted
inserted
replaced
286:954763c82cc3 | 287:ed6b74a58c66 |
---|---|
1 /* | |
2 * Copyright (c) 2011 TMate Software Ltd | |
3 * | |
4 * This program is free software; you can redistribute it and/or modify | |
5 * it under the terms of the GNU General Public License as published by | |
6 * the Free Software Foundation; version 2 of the License. | |
7 * | |
8 * This program is distributed in the hope that it will be useful, | |
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 * GNU General Public License for more details. | |
12 * | |
13 * For information on how to redistribute this software under | |
14 * the terms of a license other than GNU General Public License | |
15 * contact TMate Software at support@hg4j.com | |
16 */ | |
17 package org.tmatesoft.hg.util; | |
18 | |
19 import java.nio.channels.ReadableByteChannel; | |
20 | |
21 /** | |
22 * Subset of File-related functionality to support other than {@link java.io.File}-based {@link FileIterator} implementations | |
23 * | |
24 * @author Artem Tikhomirov | |
25 * @author TMate Software Ltd. | |
26 */ | |
27 public interface FileInfo { | |
28 | |
29 /** | |
30 * @return true if the filesystem object described by this instance exists, is a regular file and can be read | |
31 */ | |
32 boolean exists(); | |
33 | |
34 /** | |
35 * File last modification time, in seconds since Jan 1, 1970. E.g. <code> {@link java.io.File#lastModified()} / 1000 </code> | |
36 * @return int value representing time, in seconds, when file was last modified. | |
37 */ | |
38 int lastModified(); | |
39 | |
40 /** | |
41 * @return file size | |
42 */ | |
43 long length(); | |
44 | |
45 /** | |
46 * Access file contents. Caller is responsible to close the channel. | |
47 * @return file reader object, never <code>null</code> | |
48 */ | |
49 ReadableByteChannel newInputChannel(); | |
50 } |