Skip to content

Commit 5d7220a

Browse files
committed
test read from SeekableByteChannel
1 parent ec1470b commit 5d7220a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

io/jvm/src/test/scala/fs2/io/file/JvmFilesSuite.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,23 @@ class JvmFilesSuite extends Fs2Suite with BaseFileSuite {
6262
}
6363
}
6464

65+
test("read from SeekableByteChannel") {
66+
Stream
67+
.resource(
68+
tempFile
69+
.evalMap(modify)
70+
.flatMap(path =>
71+
Files[IO].openSeekableByteChannel(
72+
IO.blocking(JFiles.newByteChannel(path.toNioPath, Flag.Read.option)),
73+
new UnsupportedOperationException()
74+
)
75+
)
76+
.map(new ReadCursor[IO](_, 0))
77+
)
78+
.flatMap(_.readAll(4096).void.stream)
79+
.compile
80+
.toList
81+
.assertEquals(List[Byte](0, 1, 2, 3))
82+
}
83+
6584
}

0 commit comments

Comments
 (0)