Skip to content

Package: FileInterface

FileInterface

Coverage

1: /*
2: * Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
3: *
4: * This program and the accompanying materials are made available under the
5: * terms of the Eclipse Public License v. 2.0, which is available at
6: * http://www.eclipse.org/legal/epl-2.0.
7: *
8: * This Source Code may also be made available under the following Secondary
9: * Licenses when the conditions for such availability set forth in the
10: * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11: * version 2 with the GNU Classpath Exception, which is available at
12: * https://www.gnu.org/software/classpath/license.html.
13: *
14: * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15: */
16:
17: package org.eclipse.angus.mail.mbox;
18:
19: import java.io.File;
20: import java.io.FilenameFilter;
21:
22: public interface FileInterface {
23: /**
24: * Gets the name of the file. This method does not include the
25: * directory.
26: * @return the file name.
27: */
28: public String getName();
29:
30: /**
31: * Gets the path of the file.
32: * @return the file path.
33: */
34: public String getPath();
35:
36: /**
37: * Gets the absolute path of the file.
38: * @return the absolute file path.
39: */
40: public String getAbsolutePath();
41:
42: /**
43: * Gets the official, canonical path of the File.
44: * @return canonical path
45: */
46: // XXX - JDK1.1
47: // public String getCanonicalPath();
48:
49: /**
50: * Gets the name of the parent directory.
51: * @return the parent directory, or null if one is not found.
52: */
53: public String getParent();
54:
55: /**
56: * Returns a boolean indicating whether or not a file exists.
57: */
58: public boolean exists();
59:
60: /**
61: * Returns a boolean indicating whether or not a writable file
62: * exists.
63: */
64: public boolean canWrite();
65:
66: /**
67: * Returns a boolean indicating whether or not a readable file
68: * exists.
69: */
70: public boolean canRead();
71:
72: /**
73: * Returns a boolean indicating whether or not a normal file
74: * exists.
75: */
76: public boolean isFile();
77:
78: /**
79: * Returns a boolean indicating whether or not a directory file
80: * exists.
81: */
82: public boolean isDirectory();
83:
84: /**
85: * Returns a boolean indicating whether the file name is absolute.
86: */
87: public boolean isAbsolute();
88:
89: /**
90: * Returns the last modification time. The return value should
91: * only be used to compare modification dates. It is meaningless
92: * as an absolute time.
93: */
94: public long lastModified();
95:
96: /**
97: * Returns the length of the file.
98: */
99: public long length();
100:
101: /**
102: * Creates a directory and returns a boolean indicating the
103: * success of the creation. Will return false if the directory already
104: * exists.
105: */
106: public boolean mkdir();
107:
108: /**
109: * Renames a file and returns a boolean indicating whether
110: * or not this method was successful.
111: * @param dest the new file name
112: */
113: public boolean renameTo(File dest);
114:
115: /**
116: * Creates all directories in this path. This method
117: * returns true if the target (deepest) directory was created,
118: * false if the target directory was not created (e.g., if it
119: * existed previously).
120: */
121: public boolean mkdirs();
122:
123: /**
124: * Lists the files in a directory. Works only on directories.
125: * @return an array of file names. This list will include all
126: * files in the directory except the equivalent of "." and ".." .
127: */
128: public String[] list();
129:
130: /**
131: * Uses the specified filter to list files in a directory.
132: * @param filter the filter used to select file names
133: * @return the filter selected files in this directory.
134: * @see FilenameFilter
135: */
136: public String[] list(FilenameFilter filter);
137:
138: /**
139: * Deletes the specified file. Returns true
140: * if the file could be deleted.
141: */
142: public boolean delete();
143: }