Skip to content
Permalink
Browse files

Merge branch 'series/1.0' into series/1.1

  • Loading branch information...
mpilquist committed Jun 10, 2019
2 parents 9429436 + a79618c commit cae663f58fb4226ac7b78e0dbf35a32d5885c7fd
@@ -92,7 +92,7 @@ private[io] object JavaInputOutputStream {
val result = out match {
case Some(bytes) =>
F.delay {
Array.copy(bytes.values, 0, dest, off, bytes.size)
Array.copy(bytes.values, bytes.offset, dest, off, bytes.size)
bytes.size
}
case None =>
@@ -118,7 +118,7 @@ private[io] object JavaInputOutputStream {
out.toBytes -> rem.toBytes.some
}
F.delay {
Array.copy(copy.values, 0, dest, off, copy.size)
Array.copy(copy.values, copy.offset, dest, off, copy.size)
} >> (maybeKeep match {
case Some(rem) if rem.size > 0 =>
dnState.set(Ready(rem.some)).as(copy.size)
@@ -234,7 +234,7 @@ object AsynchronousSocketGroup {
if (srcBytes.size == srcBytes.values.size) srcBytes.values
else {
val destBytes = new Array[Byte](srcBytes.size)
Array.copy(srcBytes.values, 0, destBytes, srcBytes.offset, srcBytes.size)
Array.copy(srcBytes.values, srcBytes.offset, destBytes, 0, srcBytes.size)
destBytes
}
}
@@ -12,17 +12,8 @@ class JavaInputOutputStreamSpec extends Fs2Spec with EventuallySupport {

implicit val streamByteGenerator: Generator[Stream[IO, Byte]] =
for {
data <- strings
chunkSize <- intsBetween(1.min(data.length), data.length)
} yield {
def go(rem: String): Stream[IO, Byte] =
if (chunkSize >= rem.length) Stream.chunk(Chunk.bytes(rem.getBytes))
else {
val (out, remainder) = rem.splitAt(chunkSize)
Stream.chunk(Chunk.bytes(out.getBytes)) ++ go(remainder)
}
go(data)
}
chunks <- pureStreamGenerator[Chunk[Byte]]
} yield chunks.flatMap(Stream.chunk).covary[IO]

"arbitrary.streams" in forAll { (stream: Stream[IO, Byte]) =>
val example = stream.compile.toVector.unsafeRunSync()

0 comments on commit cae663f

Please sign in to comment.
You can’t perform that action at this time.