Skip to content

Commit ceff49a

Browse files
committed
BAEL-3603 Update variable names
1 parent 944ac49 commit ceff49a

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

core-java-modules/core-java-io-2/src/test/java/com/baeldung/blockingnonblocking/NonBlockingClientUnitTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ public void givenJavaNIOSocketChannel_whenReadingAndWritingWithBuffers_thenSucce
4040
// when we write and read using buffers
4141
socketChannel.write(charset.encode(CharBuffer.wrap("GET " + REQUESTED_RESOURCE + " HTTP/1.0\r\n\r\n")));
4242

43-
ByteBuffer buffer = ByteBuffer.allocate(8); // or allocateDirect if we need direct memory access
43+
ByteBuffer byteBuffer = ByteBuffer.allocate(8192); // or allocateDirect if we need direct memory access
4444
CharBuffer charBuffer = CharBuffer.allocate(8192);
45-
CharsetDecoder decoder = charset.newDecoder();
45+
CharsetDecoder charsetDecoder = charset.newDecoder();
4646
StringBuilder ourStore = new StringBuilder();
47-
while (socketChannel.read(buffer) != -1 || buffer.position() > 0) {
48-
buffer.flip();
49-
storeBufferContents(buffer, charBuffer, decoder, ourStore);
50-
buffer.compact();
47+
while (socketChannel.read(byteBuffer) != -1 || byteBuffer.position() > 0) {
48+
byteBuffer.flip();
49+
storeBufferContents(byteBuffer, charBuffer, charsetDecoder, ourStore);
50+
byteBuffer.compact();
5151
}
5252
socketChannel.close();
5353

@@ -67,14 +67,14 @@ public void givenJavaNIOSocketChannel_whenReadingAndWritingWithSmallBuffers_then
6767
// when we write and read using buffers that are too small for our message
6868
socketChannel.write(charset.encode(CharBuffer.wrap("GET " + REQUESTED_RESOURCE + " HTTP/1.0\r\n\r\n")));
6969

70-
ByteBuffer buffer = ByteBuffer.allocate(8); // or allocateDirect if we need direct memory access
70+
ByteBuffer byteBuffer = ByteBuffer.allocate(8); // or allocateDirect if we need direct memory access
7171
CharBuffer charBuffer = CharBuffer.allocate(8);
72-
CharsetDecoder decoder = charset.newDecoder();
72+
CharsetDecoder charsetDecoder = charset.newDecoder();
7373
StringBuilder ourStore = new StringBuilder();
74-
while (socketChannel.read(buffer) != -1 || buffer.position() > 0) {
75-
buffer.flip();
76-
storeBufferContents(buffer, charBuffer, decoder, ourStore);
77-
buffer.compact();
74+
while (socketChannel.read(byteBuffer) != -1 || byteBuffer.position() > 0) {
75+
byteBuffer.flip();
76+
storeBufferContents(byteBuffer, charBuffer, charsetDecoder, ourStore);
77+
byteBuffer.compact();
7878
}
7979
socketChannel.close();
8080

0 commit comments

Comments
 (0)