mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-09-19 06:32:12 +00:00
speedboost 3000
This commit is contained in:
+7
-2
@@ -43,6 +43,11 @@ class InMemoryFile extends InMemoryNode implements File {
|
||||
return buf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long size() throws UncheckedIOException {
|
||||
return content.get().limit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveTo(File destination) throws UncheckedIOException {
|
||||
if (destination instanceof InMemoryFile) {
|
||||
@@ -103,7 +108,7 @@ class InMemoryFile extends InMemoryNode implements File {
|
||||
throw new UncheckedIOException(new FileAlreadyExistsException(k));
|
||||
} else {
|
||||
if (v == null) {
|
||||
assert!content.get().hasRemaining();
|
||||
assert !content.get().hasRemaining();
|
||||
this.creationTime = Instant.now();
|
||||
}
|
||||
this.lastModified = Instant.now();
|
||||
@@ -120,7 +125,7 @@ class InMemoryFile extends InMemoryNode implements File {
|
||||
// returning null removes the entry.
|
||||
return null;
|
||||
});
|
||||
assert!this.exists();
|
||||
assert !this.exists();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
-5
@@ -51,11 +51,6 @@ class InMemoryReadableFile implements ReadableFile {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long size() throws UncheckedIOException {
|
||||
return contentGetter.get().limit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void position(long position) throws UncheckedIOException {
|
||||
assert position < Integer.MAX_VALUE : "Can not use that big in-memory files.";
|
||||
|
||||
+1
-3
@@ -104,9 +104,7 @@ public class InMemoryFileSystemTest {
|
||||
Assert.assertTrue(fooFile.exists());
|
||||
|
||||
// check if size = 11 bytes
|
||||
try (ReadableFile readable = fooFile.openReadable()) {
|
||||
Assert.assertEquals(11, readable.size());
|
||||
}
|
||||
Assert.assertEquals(11, fooFile.size());
|
||||
|
||||
// copy foo to bar
|
||||
File barFile = fs.file("bar.txt");
|
||||
|
||||
Reference in New Issue
Block a user