File tree Expand file tree Collapse file tree 3 files changed +7
-11
lines changed
jvm/src/main/scala/fs2/io/net
shared/src/main/scala/fs2/io/net Expand file tree Collapse file tree 3 files changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -91,8 +91,7 @@ private final class SelectingSocket[F[_]: LiftIO] private (
9191 def go (currOffset : Long , remaining : Long ): F [Unit ] =
9292 if (remaining <= 0 ) F .unit
9393 else {
94- val toTransfer = remaining.min(chunkSize.toLong)
95- F .blocking(fileChannel.transferTo(currOffset, toTransfer, ch)).flatMap { written =>
94+ F .blocking(fileChannel.transferTo(currOffset, remaining, ch)).flatMap { written =>
9695 if (written > 0 ) {
9796 go(currOffset + written, remaining - written)
9897 } else {
@@ -119,8 +118,7 @@ private final class SelectingSocket[F[_]: LiftIO] private (
119118 def go (currOffset : Long , remaining : Long ): F [Unit ] =
120119 if (remaining <= 0 ) F .unit
121120 else {
122- val toTransfer = remaining.min(chunkSize.toLong)
123- F .blocking(fileChannel.transferFrom(ch, currOffset, toTransfer)).flatMap { readBytes =>
121+ F .blocking(fileChannel.transferFrom(ch, currOffset, remaining)).flatMap { readBytes =>
124122 if (readBytes > 0 ) {
125123 go(currOffset + readBytes, remaining - readBytes)
126124 } else {
Original file line number Diff line number Diff line change @@ -150,8 +150,7 @@ private[unixsocket] trait UnixSocketsCompanionPlatform {
150150 def go (currOffset : Long , remaining : Long ): F [Unit ] =
151151 if (remaining <= 0 ) F .unit
152152 else {
153- val toTransfer = remaining.min(chunkSize.toLong)
154- F .blocking(fileChannel.transferTo(currOffset, toTransfer, ch)).flatMap { written =>
153+ F .blocking(fileChannel.transferTo(currOffset, remaining, ch)).flatMap { written =>
155154 if (written == 0 ) F .unit
156155 else {
157156 go(currOffset + written, remaining - written)
@@ -177,8 +176,7 @@ private[unixsocket] trait UnixSocketsCompanionPlatform {
177176 def go (currOffset : Long , remaining : Long ): F [Unit ] =
178177 if (remaining <= 0 ) F .unit
179178 else {
180- val toTransfer = remaining.min(chunkSize.toLong)
181- F .blocking(fileChannel.transferFrom(ch, currOffset, toTransfer)).flatMap { readBytes =>
179+ F .blocking(fileChannel.transferFrom(ch, currOffset, remaining)).flatMap { readBytes =>
182180 if (readBytes == 0 ) F .unit
183181 else {
184182 go(currOffset + readBytes, remaining - readBytes)
Original file line number Diff line number Diff line change @@ -71,8 +71,8 @@ trait Socket[F[_]] {
7171 */
7272 def writes : Pipe [F , Byte , Nothing ]
7373
74- /** Reads a file in chunks and writes it to a socket.
75- * Streams the file contents in chunks of the specified size and sends them over the socket.
74+ /** Reads a file and writes it to a socket.
75+ * Streams the file contents of the specified size and sends them over the socket.
7676 * The stream terminates when the entire file has reached end of file or the specified count is reached.
7777 *
7878 * @param file the file handle to read from
@@ -100,7 +100,7 @@ trait Socket[F[_]] {
100100 }
101101
102102 /** Reads from a socket and writes to a file.
103- * Streams the socket data in chunks of the specified size and writes them to the file.
103+ * Streams the socket data of the specified size and writes them to the file.
104104 * The stream terminates when the socket signals end of input or the specified count is reached.
105105 *
106106 * @param file the file handle to write to
You can’t perform that action at this time.
0 commit comments