Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfrijters <jfrijters>2011-08-17 13:59:28 +0400
committerjfrijters <jfrijters>2011-08-17 13:59:28 +0400
commit71e6efc7e422ebd0f32d7a96e0d8fde75fc6a65f (patch)
tree649b83511536a2c1a908278314a3fccb6fcc58fc /openjdk/sun
parent936bcbc8a24d9c1a12ff91ef09338629fc79c9b0 (diff)
Implemented copy.
Diffstat (limited to 'openjdk/sun')
-rw-r--r--openjdk/sun/nio/fs/NetFileSystemProvider.java47
1 files changed, 46 insertions, 1 deletions
diff --git a/openjdk/sun/nio/fs/NetFileSystemProvider.java b/openjdk/sun/nio/fs/NetFileSystemProvider.java
index 427cde2e..03a781f8 100644
--- a/openjdk/sun/nio/fs/NetFileSystemProvider.java
+++ b/openjdk/sun/nio/fs/NetFileSystemProvider.java
@@ -25,6 +25,7 @@
package sun.nio.fs;
import ikvm.internal.NotYetImplementedError;
+import cli.System.IO.File;
import cli.System.IO.FileMode;
import cli.System.IO.FileShare;
import cli.System.IO.FileStream;
@@ -229,7 +230,51 @@ final class NetFileSystemProvider extends AbstractFileSystemProvider
public void copy(Path source, Path target, CopyOption... options) throws IOException
{
- throw new NotYetImplementedError();
+ NetPath nsource = NetPath.from(source);
+ NetPath ntarget = NetPath.from(target);
+ boolean overwrite = false;
+ for (CopyOption opt : options)
+ {
+ if (opt == StandardCopyOption.REPLACE_EXISTING)
+ {
+ overwrite = true;
+ }
+ else
+ {
+ throw new UnsupportedOperationException("Unsupported copy option");
+ }
+ }
+ try
+ {
+ if (false) throw new cli.System.ArgumentException();
+ if (false) throw new cli.System.IO.FileNotFoundException();
+ if (false) throw new cli.System.IO.DirectoryNotFoundException();
+ if (false) throw new cli.System.PlatformNotSupportedException();
+ if (false) throw new cli.System.IO.IOException();
+ if (false) throw new cli.System.Security.SecurityException();
+ if (false) throw new cli.System.UnauthorizedAccessException();
+ File.Copy(nsource.path, ntarget.path, overwrite);
+ }
+ catch (cli.System.IO.FileNotFoundException x)
+ {
+ throw new NoSuchFileException(x.get_FileName());
+ }
+ catch (cli.System.IO.DirectoryNotFoundException x)
+ {
+ throw new NoSuchFileException(nsource.path, ntarget.path, x.getMessage());
+ }
+ catch (cli.System.PlatformNotSupportedException x)
+ {
+ throw new UnsupportedOperationException(x.getMessage());
+ }
+ catch (cli.System.IO.IOException | cli.System.ArgumentException x)
+ {
+ throw new FileSystemException(nsource.path, ntarget.path, x.getMessage());
+ }
+ catch (cli.System.Security.SecurityException | cli.System.UnauthorizedAccessException x)
+ {
+ throw new AccessDeniedException(nsource.path, ntarget.path, x.getMessage());
+ }
}
public void move(Path source, Path target, CopyOption... options) throws IOException