From 38843e814bfcee140d766957f63514e984210230 Mon Sep 17 00:00:00 2001 From: Roger Yates <587230+rojyates@users.noreply.github.com> Date: Tue, 17 Mar 2020 06:32:39 +1000 Subject: [PATCH] BAEL-3603 Update variable names --- .../NonBlockingClientUnitTest.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/core-java-modules/core-java-io-2/src/test/java/com/baeldung/blockingnonblocking/NonBlockingClientUnitTest.java b/core-java-modules/core-java-io-2/src/test/java/com/baeldung/blockingnonblocking/NonBlockingClientUnitTest.java index 90edee0306..838d456f03 100644 --- a/core-java-modules/core-java-io-2/src/test/java/com/baeldung/blockingnonblocking/NonBlockingClientUnitTest.java +++ b/core-java-modules/core-java-io-2/src/test/java/com/baeldung/blockingnonblocking/NonBlockingClientUnitTest.java @@ -40,14 +40,14 @@ public class NonBlockingClientUnitTest { // when we write and read using buffers socketChannel.write(charset.encode(CharBuffer.wrap("GET " + REQUESTED_RESOURCE + " HTTP/1.0\r\n\r\n"))); - ByteBuffer buffer = ByteBuffer.allocate(8); // or allocateDirect if we need direct memory access + ByteBuffer byteBuffer = ByteBuffer.allocate(8192); // or allocateDirect if we need direct memory access CharBuffer charBuffer = CharBuffer.allocate(8192); - CharsetDecoder decoder = charset.newDecoder(); + CharsetDecoder charsetDecoder = charset.newDecoder(); StringBuilder ourStore = new StringBuilder(); - while (socketChannel.read(buffer) != -1 || buffer.position() > 0) { - buffer.flip(); - storeBufferContents(buffer, charBuffer, decoder, ourStore); - buffer.compact(); + while (socketChannel.read(byteBuffer) != -1 || byteBuffer.position() > 0) { + byteBuffer.flip(); + storeBufferContents(byteBuffer, charBuffer, charsetDecoder, ourStore); + byteBuffer.compact(); } socketChannel.close(); @@ -67,14 +67,14 @@ public class NonBlockingClientUnitTest { // when we write and read using buffers that are too small for our message socketChannel.write(charset.encode(CharBuffer.wrap("GET " + REQUESTED_RESOURCE + " HTTP/1.0\r\n\r\n"))); - ByteBuffer buffer = ByteBuffer.allocate(8); // or allocateDirect if we need direct memory access + ByteBuffer byteBuffer = ByteBuffer.allocate(8); // or allocateDirect if we need direct memory access CharBuffer charBuffer = CharBuffer.allocate(8); - CharsetDecoder decoder = charset.newDecoder(); + CharsetDecoder charsetDecoder = charset.newDecoder(); StringBuilder ourStore = new StringBuilder(); - while (socketChannel.read(buffer) != -1 || buffer.position() > 0) { - buffer.flip(); - storeBufferContents(buffer, charBuffer, decoder, ourStore); - buffer.compact(); + while (socketChannel.read(byteBuffer) != -1 || byteBuffer.position() > 0) { + byteBuffer.flip(); + storeBufferContents(byteBuffer, charBuffer, charsetDecoder, ourStore); + byteBuffer.compact(); } socketChannel.close();