33 /**
34 * @author Michael Martak
35 * @since 1.4
36 */
37 @SuppressWarnings("serial") // JDK-implementation class
38 class DefaultShellFolder extends ShellFolder {
39
40 /**
41 * Create a file system shell folder from a file
42 */
43 DefaultShellFolder(ShellFolder parent, File f) {
44 super(parent, f.getAbsolutePath());
45 }
46
47 /**
48 * This method is implemented to make sure that no instances
49 * of <code>ShellFolder</code> are ever serialized. An instance of
50 * this default implementation can always be represented with a
51 * <code>java.io.File</code> object instead.
52 *
53 * @returns a <code>java.io.File</code> replacement object.
54 */
55 protected Object writeReplace() throws java.io.ObjectStreamException {
56 return new File(getPath());
57 }
58
59 /**
60 * @return An array of shell folders that are children of this shell folder
61 * object, null if this shell folder is empty.
62 */
63 public File[] listFiles() {
64 File[] files = super.listFiles();
65 if (files != null) {
66 for (int i = 0; i < files.length; i++) {
67 files[i] = new DefaultShellFolder(this, files[i]);
68 }
69 }
70 return files;
71 }
72
73 /**
|
33 /**
34 * @author Michael Martak
35 * @since 1.4
36 */
37 @SuppressWarnings("serial") // JDK-implementation class
38 class DefaultShellFolder extends ShellFolder {
39
40 /**
41 * Create a file system shell folder from a file
42 */
43 DefaultShellFolder(ShellFolder parent, File f) {
44 super(parent, f.getAbsolutePath());
45 }
46
47 /**
48 * This method is implemented to make sure that no instances
49 * of <code>ShellFolder</code> are ever serialized. An instance of
50 * this default implementation can always be represented with a
51 * <code>java.io.File</code> object instead.
52 *
53 * @return a java.io.File replacement object.
54 */
55 protected Object writeReplace() throws java.io.ObjectStreamException {
56 return new File(getPath());
57 }
58
59 /**
60 * @return An array of shell folders that are children of this shell folder
61 * object, null if this shell folder is empty.
62 */
63 public File[] listFiles() {
64 File[] files = super.listFiles();
65 if (files != null) {
66 for (int i = 0; i < files.length; i++) {
67 files[i] = new DefaultShellFolder(this, files[i]);
68 }
69 }
70 return files;
71 }
72
73 /**
|