Refactored filesystem api

* Removed Readable- and WritableBytes
** Replaced with Readable-/WritableByteChannel
** Methods now integrated in Readable- and WritableFile
** Replaced positioned read/write by method to set the position
This commit is contained in:
Markus Kreusch
2015-12-28 20:54:18 +01:00
parent 1804a52740
commit 356ea5c319
14 changed files with 155 additions and 131 deletions
@@ -136,7 +136,8 @@ public class InMemoryFileSystemTest {
}
final ByteBuffer readBuf = ByteBuffer.allocate(5);
try (ReadableFile readable = bazFile.openReadable()) {
readable.read(readBuf, 6);
readable.position(6);
readable.read(readBuf);
}
Assert.assertEquals("world", new String(readBuf.array()));
}
@@ -159,7 +160,8 @@ public class InMemoryFileSystemTest {
Assert.assertTrue(test1File.exists());
Assert.assertTrue(test2File.exists());
// copy foo/bar/ to qwe/asd/ (result is qwe/asd/file1.txt & qwe/asd/file2.txt)
// copy foo/bar/ to qwe/asd/ (result is qwe/asd/file1.txt &
// qwe/asd/file2.txt)
fooBarFolder.copyTo(qweAsdFolder);
Assert.assertTrue(qweAsdFolder.exists());
Assert.assertEquals(2, qweAsdFolder.files().count());