diff --git a/akka-remote/src/main/scala/akka/remote/Endpoint.scala b/akka-remote/src/main/scala/akka/remote/Endpoint.scala index 99b1347f70..b446b0276b 100644 --- a/akka-remote/src/main/scala/akka/remote/Endpoint.scala +++ b/akka-remote/src/main/scala/akka/remote/Endpoint.scala @@ -496,7 +496,7 @@ private[remote] class ReliableDeliverySupervisor( // If we have not confirmed the remote UID we cannot transfer the system message at this point just buffer it. // GotUid will kick resendAll() causing the messages to be properly written. // Flow control by not sending more when we already have many outstanding. - if (uidConfirmed && resendBuffer.nonAcked.size <= settings.SysResendLimit) + if (uidConfirmed && resendBuffer.nonAcked.length <= settings.SysResendLimit) writer ! sequencedSend } else writer ! send @@ -1130,7 +1130,7 @@ private[remote] class EndpointReader( override def receive: Receive = { case Disassociated(info) => handleDisassociated(info) - case InboundPayload(p) if p.size <= transport.maximumPayloadBytes => + case InboundPayload(p) if p.length <= transport.maximumPayloadBytes => val (ackOption, msgOption) = tryDecodeMessageAndAck(p) for (ack <- ackOption; reliableDelivery <- reliableDeliverySupervisor) reliableDelivery ! ack @@ -1180,7 +1180,7 @@ private[remote] class EndpointReader( case StopReading(writer, replyTo) => replyTo ! StoppedReading(writer) - case InboundPayload(p) if p.size <= transport.maximumPayloadBytes => + case InboundPayload(p) if p.length <= transport.maximumPayloadBytes => val (ackOption, msgOption) = tryDecodeMessageAndAck(p) for (ack <- ackOption; reliableDelivery <- reliableDeliverySupervisor) reliableDelivery ! ack diff --git a/akka-remote/src/main/scala/akka/remote/artery/tcp/TcpFraming.scala b/akka-remote/src/main/scala/akka/remote/artery/tcp/TcpFraming.scala index 5f7b0bb7d0..1594ae499a 100644 --- a/akka-remote/src/main/scala/akka/remote/artery/tcp/TcpFraming.scala +++ b/akka-remote/src/main/scala/akka/remote/artery/tcp/TcpFraming.scala @@ -69,7 +69,7 @@ import akka.util.ByteString case object ReadMagic extends Step { override def parse(reader: ByteReader): ParseResult[EnvelopeBuffer] = { - val magic = reader.take(TcpFraming.Magic.size) + val magic = reader.take(TcpFraming.Magic.length) if (magic == TcpFraming.Magic) ParseResult(None, ReadStreamId) else diff --git a/akka-stream/src/main/scala/akka/stream/impl/io/ByteStringParser.scala b/akka-stream/src/main/scala/akka/stream/impl/io/ByteStringParser.scala index fd5c122daa..52578b0a2a 100644 --- a/akka-stream/src/main/scala/akka/stream/impl/io/ByteStringParser.scala +++ b/akka-stream/src/main/scala/akka/stream/impl/io/ByteStringParser.scala @@ -185,8 +185,8 @@ import akka.util.ByteString private[this] var off = 0 - def hasRemaining: Boolean = off < input.size - def remainingSize: Int = input.size - off + def hasRemaining: Boolean = off < input.length + def remainingSize: Int = input.length - off def currentOffset: Int = off diff --git a/akka-stream/src/main/scala/akka/stream/impl/io/compression/DeflateCompressor.scala b/akka-stream/src/main/scala/akka/stream/impl/io/compression/DeflateCompressor.scala index a904232c8e..f7cf90e0de 100644 --- a/akka-stream/src/main/scala/akka/stream/impl/io/compression/DeflateCompressor.scala +++ b/akka-stream/src/main/scala/akka/stream/impl/io/compression/DeflateCompressor.scala @@ -19,12 +19,12 @@ import akka.util.{ ByteString, ByteStringBuilder } protected lazy val deflater = new Deflater(level, nowrap) override final def compressAndFlush(input: ByteString): ByteString = { - val buffer = newTempBuffer(input.size) + val buffer = newTempBuffer(input.length) compressWithBuffer(input, buffer) ++ flushWithBuffer(buffer) } override final def compressAndFinish(input: ByteString): ByteString = { - val buffer = newTempBuffer(input.size) + val buffer = newTempBuffer(input.length) compressWithBuffer(input, buffer) ++ finishWithBuffer(buffer) } diff --git a/akka-stream/src/main/scala/akka/stream/scaladsl/Framing.scala b/akka-stream/src/main/scala/akka/stream/scaladsl/Framing.scala index e03efa0084..cf3f57b112 100644 --- a/akka-stream/src/main/scala/akka/stream/scaladsl/Framing.scala +++ b/akka-stream/src/main/scala/akka/stream/scaladsl/Framing.scala @@ -265,27 +265,27 @@ object Framing { s"Read ${possibleMatchPos - previous} bytes " + s"which is more than $maximumLineBytes without seeing a line terminator")) } else if (possibleMatchPos == -1) { - if (buffer.size - previous > maximumLineBytes) + if (buffer.length - previous > maximumLineBytes) failStage( new FramingException( - s"Read ${buffer.size - previous} bytes " + + s"Read ${buffer.length - previous} bytes " + s"which is more than $maximumLineBytes without seeing a line terminator")) else { // No matching character, we need to accumulate more bytes into the buffer - nextPossibleMatch = buffer.size + nextPossibleMatch = buffer.length doParse() } - } else if (possibleMatchPos + separatorBytes.size > buffer.size) { + } else if (possibleMatchPos + separatorBytes.length > buffer.length) { // We have found a possible match (we found the first character of the terminator // sequence) but we don't have yet enough bytes. We remember the position to // retry from next time. nextPossibleMatch = possibleMatchPos doParse() - } else if (buffer.slice(possibleMatchPos, possibleMatchPos + separatorBytes.size) == separatorBytes) { + } else if (buffer.slice(possibleMatchPos, possibleMatchPos + separatorBytes.length) == separatorBytes) { // Found a match, mark start and end position and iterate if possible indices += (previous -> possibleMatchPos) - nextPossibleMatch = possibleMatchPos + separatorBytes.size - if (nextPossibleMatch == buffer.size || indices.isFull) { + nextPossibleMatch = possibleMatchPos + separatorBytes.length + if (nextPossibleMatch == buffer.length || indices.isFull) { doParse() } else { searchIndices()