1 /* |
1 /* |
2 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
146 |
146 |
147 /* -- File operations -- */ |
147 /* -- File operations -- */ |
148 |
148 |
149 /** |
149 /** |
150 * Create a new empty file with the given pathname. Return |
150 * Create a new empty file with the given pathname. Return |
151 * <code>true</code> if the file was created and <code>false</code> if a |
151 * {@code true} if the file was created and {@code false} if a |
152 * file or directory with the given pathname already exists. Throw an |
152 * file or directory with the given pathname already exists. Throw an |
153 * IOException if an I/O error occurs. |
153 * IOException if an I/O error occurs. |
154 */ |
154 */ |
155 public abstract boolean createFileExclusively(String pathname) |
155 public abstract boolean createFileExclusively(String pathname) |
156 throws IOException; |
156 throws IOException; |
157 |
157 |
158 /** |
158 /** |
159 * Delete the file or directory denoted by the given abstract pathname, |
159 * Delete the file or directory denoted by the given abstract pathname, |
160 * returning <code>true</code> if and only if the operation succeeds. |
160 * returning {@code true} if and only if the operation succeeds. |
161 */ |
161 */ |
162 public abstract boolean delete(File f); |
162 public abstract boolean delete(File f); |
163 |
163 |
164 /** |
164 /** |
165 * List the elements of the directory denoted by the given abstract |
165 * List the elements of the directory denoted by the given abstract |
166 * pathname. Return an array of strings naming the elements of the |
166 * pathname. Return an array of strings naming the elements of the |
167 * directory if successful; otherwise, return <code>null</code>. |
167 * directory if successful; otherwise, return {@code null}. |
168 */ |
168 */ |
169 public abstract String[] list(File f); |
169 public abstract String[] list(File f); |
170 |
170 |
171 /** |
171 /** |
172 * Create a new directory denoted by the given abstract pathname, |
172 * Create a new directory denoted by the given abstract pathname, |
173 * returning <code>true</code> if and only if the operation succeeds. |
173 * returning {@code true} if and only if the operation succeeds. |
174 */ |
174 */ |
175 public abstract boolean createDirectory(File f); |
175 public abstract boolean createDirectory(File f); |
176 |
176 |
177 /** |
177 /** |
178 * Rename the file or directory denoted by the first abstract pathname to |
178 * Rename the file or directory denoted by the first abstract pathname to |
179 * the second abstract pathname, returning <code>true</code> if and only if |
179 * the second abstract pathname, returning {@code true} if and only if |
180 * the operation succeeds. |
180 * the operation succeeds. |
181 */ |
181 */ |
182 public abstract boolean rename(File f1, File f2); |
182 public abstract boolean rename(File f1, File f2); |
183 |
183 |
184 /** |
184 /** |
185 * Set the last-modified time of the file or directory denoted by the |
185 * Set the last-modified time of the file or directory denoted by the |
186 * given abstract pathname, returning <code>true</code> if and only if the |
186 * given abstract pathname, returning {@code true} if and only if the |
187 * operation succeeds. |
187 * operation succeeds. |
188 */ |
188 */ |
189 public abstract boolean setLastModifiedTime(File f, long time); |
189 public abstract boolean setLastModifiedTime(File f, long time); |
190 |
190 |
191 /** |
191 /** |
192 * Mark the file or directory denoted by the given abstract pathname as |
192 * Mark the file or directory denoted by the given abstract pathname as |
193 * read-only, returning <code>true</code> if and only if the operation |
193 * read-only, returning {@code true} if and only if the operation |
194 * succeeds. |
194 * succeeds. |
195 */ |
195 */ |
196 public abstract boolean setReadOnly(File f); |
196 public abstract boolean setReadOnly(File f); |
197 |
197 |
198 |
198 |