Skip to content

Commit 703d997

Browse files
hansonrhansonr
authored andcommitted
java.nio.Files support, including swingjs.JSFileSystem
1 parent 8a33a93 commit 703d997

File tree

8 files changed

+521
-63
lines changed

8 files changed

+521
-63
lines changed

sources/net.sf.j2s.java.core/src/java/io/FileInputStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import java.nio.channels.FileChannel;
2929
//import sun.nio.ch.FileChannelImpl;
3030

31-
import swingjs.JSFileChannel;
31+
import swingjs.JSFileSystem.JSFileChannel;
3232
import swingjs.JSTempFile;
3333
import swingjs.JSUtil;
3434

sources/net.sf.j2s.java.core/src/java/io/FileOutputStream.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
package java.io;
2727

2828
import java.nio.channels.FileChannel;
29-
import sun.nio.ch.FileChannelImpl;
30-
import swingjs.JSFileChannel;
29+
30+
import swingjs.JSFileSystem.JSFileChannel;
3131
import swingjs.JSTempFile;
3232
import javajs.util.OC;
3333

sources/net.sf.j2s.java.core/src/java/nio/channels/Channels.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private static void writeFully(WritableByteChannel ch, ByteBuffer bb)
123123
*/
124124
public static InputStream newInputStream(ReadableByteChannel ch) {
125125
checkNotNull(ch, "ch");
126-
return ((JSFileSystem.JSSeekableByteChannel) ch).getInputStream();
126+
return ((JSFileSystem.JSByteChannel) ch).getInputStream();
127127
// return new sun.nio.ch.ChannelInputStream(ch);
128128
}
129129

sources/net.sf.j2s.java.core/src/java/nio/channels/FileChannel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ public static FileChannel open(Path path,
288288
}
289289

290290
@SuppressWarnings({"unchecked", "rawtypes"}) // generic array construction
291-
private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
291+
protected static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0]; // SwingJS was private
292292

293293
/**
294294
* Opens or creates a file, returning a file channel to access the file.

sources/net.sf.j2s.java.core/src/java/nio/file/Files.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ public static boolean deleteIfExists(Path path) throws IOException {
11991199
* <td> Attempts to copy the file attributes associated with this file to
12001200
* the target file. The exact file attributes that are copied is platform
12011201
* and file system dependent and therefore unspecified. Minimally, the
1202-
* {@link BasicFileAttributes#lastModifiedTime last-modified-time} is
1202+
* {@link BasicFileAttributes#lastModified last-modified-time} is
12031203
* copied to the target file if supported by both the source and target
12041204
* file stores. Copying of file timestamps may result in precision
12051205
* loss. </td>
@@ -1329,7 +1329,7 @@ public static Path copy(Path source, Path target, CopyOption... options)
13291329
* implementation specific options.
13301330
*
13311331
* <p> Moving a file will copy the {@link
1332-
* BasicFileAttributes#lastModifiedTime last-modified-time} to the target
1332+
* BasicFileAttributes#lastModified last-modified-time} to the target
13331333
* file if supported by both source and target file stores. Copying of file
13341334
* timestamps may result in precision loss. An implementation may also
13351335
* attempt to copy other file attributes but is not required to fail if the
@@ -2258,7 +2258,7 @@ public static boolean isRegularFile(Path path, LinkOption... options) {
22582258
* installed, its {@link SecurityManager#checkRead(String) checkRead}
22592259
* method denies read access to the file.
22602260
*
2261-
* @see BasicFileAttributes#lastModifiedTime
2261+
* @see BasicFileAttributes#lastModified
22622262
*/
22632263
public static FileTime getLastModifiedTime(Path path, LinkOption... options)
22642264
throws IOException

0 commit comments

Comments
 (0)