@@ -769,6 +769,9 @@ public boolean canWrite() {
769769 }
770770
771771 /**
772+ *
773+ * SwingJS note: All directories are considered to exist.
774+ *
772775 * Tests whether the file or directory denoted by this abstract pathname
773776 * exists.
774777 *
@@ -785,6 +788,9 @@ public boolean exists() {
785788 }
786789
787790 /**
791+ * SwingJS note: The only way we can check if something is a directory is if
792+ * its path is the same as its prefix length. That is, if it ends with "/".
793+ *
788794 * Tests whether the file denoted by this abstract pathname is a
789795 * directory.
790796 *
@@ -1085,85 +1091,85 @@ public File[] listFiles() {
10851091 }
10861092 return fs ;
10871093 }
1088- //
1089- // /**
1090- // * Returns an array of abstract pathnames denoting the files and
1091- // * directories in the directory denoted by this abstract pathname that
1092- // * satisfy the specified filter. The behavior of this method is the same
1093- // * as that of the {@link #listFiles()} method, except that the pathnames in
1094- // * the returned array must satisfy the filter. If the given {@code filter}
1095- // * is {@code null} then all pathnames are accepted. Otherwise, a pathname
1096- // * satisfies the filter if and only if the value {@code true} results when
1097- // * the {@link FilenameFilter#accept
1098- // * FilenameFilter.accept(File, String)} method of the filter is
1099- // * invoked on this abstract pathname and the name of a file or directory in
1100- // * the directory that it denotes.
1101- // *
1102- // * @param filter
1103- // * A filename filter
1104- // *
1105- // * @return An array of abstract pathnames denoting the files and
1106- // * directories in the directory denoted by this abstract pathname.
1107- // * The array will be empty if the directory is empty. Returns
1108- // * {@code null} if this abstract pathname does not denote a
1109- // * directory, or if an I/O error occurs.
1110- // *
1111- // * @throws SecurityException
1112- // * If a security manager exists and its {@link
1113- // * SecurityManager#checkRead(String)} method denies read access to
1114- // * the directory
1115- // *
1116- // * @since 1.2
1117- // */
1118- // public File[] listFiles(FilenameFilter filter) {
1119- // String ss[] = list();
1120- // if (ss == null) return null;
1121- // ArrayList<File> files = new ArrayList<File>();
1122- // for (String s : ss)
1123- // if ((filter == null) || filter.accept(this, s))
1124- // files.add(new File(s, this));
1125- // return files.toArray(new File[files.size()]);
1126- // }
1127- //
1128- // /**
1129- // * Returns an array of abstract pathnames denoting the files and
1130- // * directories in the directory denoted by this abstract pathname that
1131- // * satisfy the specified filter. The behavior of this method is the same
1132- // * as that of the {@link #listFiles()} method, except that the pathnames in
1133- // * the returned array must satisfy the filter. If the given {@code filter}
1134- // * is {@code null} then all pathnames are accepted. Otherwise, a pathname
1135- // * satisfies the filter if and only if the value {@code true} results when
1136- // * the {@link FileFilter#accept FileFilter.accept(File)} method of the
1137- // * filter is invoked on the pathname.
1138- // *
1139- // * @param filter
1140- // * A file filter
1141- // *
1142- // * @return An array of abstract pathnames denoting the files and
1143- // * directories in the directory denoted by this abstract pathname.
1144- // * The array will be empty if the directory is empty. Returns
1145- // * {@code null} if this abstract pathname does not denote a
1146- // * directory, or if an I/O error occurs.
1147- // *
1148- // * @throws SecurityException
1149- // * If a security manager exists and its {@link
1150- // * SecurityManager#checkRead(String)} method denies read access to
1151- // * the directory
1152- // *
1153- // * @since 1.2
1154- // */
1155- // public File[] listFiles(FileFilter filter) {
1156- // String ss[] = list();
1157- // if (ss == null) return null;
1158- // ArrayList<File> files = new ArrayList<File>();
1159- // for (String s : ss) {
1160- // File f = new File(s, this);
1161- // if ((filter == null) || filter.accept(f))
1162- // files.add(f);
1163- // }
1164- // return files.toArray(new File[files.size()]);
1165- // }
1166- //
1094+
1095+ /**
1096+ * Returns an array of abstract pathnames denoting the files and
1097+ * directories in the directory denoted by this abstract pathname that
1098+ * satisfy the specified filter. The behavior of this method is the same
1099+ * as that of the {@link #listFiles()} method, except that the pathnames in
1100+ * the returned array must satisfy the filter. If the given {@code filter}
1101+ * is {@code null} then all pathnames are accepted. Otherwise, a pathname
1102+ * satisfies the filter if and only if the value {@code true} results when
1103+ * the {@link FilenameFilter#accept
1104+ * FilenameFilter.accept(File, String)} method of the filter is
1105+ * invoked on this abstract pathname and the name of a file or directory in
1106+ * the directory that it denotes.
1107+ *
1108+ * @param filter
1109+ * A filename filter
1110+ *
1111+ * @return An array of abstract pathnames denoting the files and
1112+ * directories in the directory denoted by this abstract pathname.
1113+ * The array will be empty if the directory is empty. Returns
1114+ * {@code null} if this abstract pathname does not denote a
1115+ * directory, or if an I/O error occurs.
1116+ *
1117+ * @throws SecurityException
1118+ * If a security manager exists and its {@link
1119+ * SecurityManager#checkRead(String)} method denies read access to
1120+ * the directory
1121+ *
1122+ * @since 1.2
1123+ */
1124+ public File [] listFiles (FilenameFilter filter ) {
1125+ String ss [] = list ();
1126+ if (ss == null ) return null ;
1127+ ArrayList <File > files = new ArrayList <File >();
1128+ for (String s : ss )
1129+ if ((filter == null ) || filter .accept (this , s ))
1130+ files .add (new File (s , this ));
1131+ return files .toArray (new File [files .size ()]);
1132+ }
1133+
1134+ /**
1135+ * Returns an array of abstract pathnames denoting the files and
1136+ * directories in the directory denoted by this abstract pathname that
1137+ * satisfy the specified filter. The behavior of this method is the same
1138+ * as that of the {@link #listFiles()} method, except that the pathnames in
1139+ * the returned array must satisfy the filter. If the given {@code filter}
1140+ * is {@code null} then all pathnames are accepted. Otherwise, a pathname
1141+ * satisfies the filter if and only if the value {@code true} results when
1142+ * the {@link FileFilter#accept FileFilter.accept(File)} method of the
1143+ * filter is invoked on the pathname.
1144+ *
1145+ * @param filter
1146+ * A file filter
1147+ *
1148+ * @return An array of abstract pathnames denoting the files and
1149+ * directories in the directory denoted by this abstract pathname.
1150+ * The array will be empty if the directory is empty. Returns
1151+ * {@code null} if this abstract pathname does not denote a
1152+ * directory, or if an I/O error occurs.
1153+ *
1154+ * @throws SecurityException
1155+ * If a security manager exists and its {@link
1156+ * SecurityManager#checkRead(String)} method denies read access to
1157+ * the directory
1158+ *
1159+ * @since 1.2
1160+ */
1161+ public File [] listFiles (FileFilter filter ) {
1162+ String ss [] = list ();
1163+ if (ss == null ) return null ;
1164+ ArrayList <File > files = new ArrayList <File >();
1165+ for (String s : ss ) {
1166+ File f = new File (s , this );
1167+ if ((filter == null ) || filter .accept (f ))
1168+ files .add (f );
1169+ }
1170+ return files .toArray (new File [files .size ()]);
1171+ }
1172+
11671173 /**
11681174 * Creates the directory named by this abstract pathname.
11691175 *
0 commit comments