mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-09-19 06:32:12 +00:00
Implemented NioFile
* Implementation of NioFile methods * Extracted Readable/WritableNioFile into separate classes ** Created SharedFileChannel to allow Readable/WritableNioFile for the same NioFile to use a single, shared FileChannel * Added tests for NioFile * Tests for Readable/WritableNioFile pending
This commit is contained in:
@@ -11,6 +11,9 @@ package org.cryptomator.filesystem;
|
||||
class Mover {
|
||||
|
||||
public static void move(File source, File destination) {
|
||||
if (source == destination) {
|
||||
return;
|
||||
}
|
||||
try (OpenFiles openFiles = DeadlockSafeFileOpener.withWritable(source).andWritable(destination).open()) {
|
||||
openFiles.writable(source).moveTo(openFiles.writable(destination));
|
||||
}
|
||||
|
||||
@@ -13,6 +13,13 @@ import java.time.Instant;
|
||||
|
||||
public interface WritableFile extends WritableByteChannel {
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Moves this file including content to another.
|
||||
* <p>
|
||||
* Moving a file causes itself and the target to be
|
||||
* {@link WritableFile#close() closed}.
|
||||
*/
|
||||
void moveTo(WritableFile other) throws UncheckedIOException;
|
||||
|
||||
void setLastModified(Instant instant) throws UncheckedIOException;
|
||||
|
||||
Reference in New Issue
Block a user