aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib/src/main/java/com/yahoo/io
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-01-07 22:43:35 +0100
committerJon Bratseth <bratseth@gmail.com>2022-01-07 22:43:35 +0100
commit716aaa5f698c27cada87526be85c705f3b441441 (patch)
tree8934cb3ca479956368e8f31807c7ee435a6babb0 /vespajlib/src/main/java/com/yahoo/io
parentc29684ae7128469f709fd3f3786d5eda8615fbf6 (diff)
Cleanup; No functional changes
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/io')
-rw-r--r--vespajlib/src/main/java/com/yahoo/io/AbstractByteWriter.java3
-rw-r--r--vespajlib/src/main/java/com/yahoo/io/BufferChain.java1
-rw-r--r--vespajlib/src/main/java/com/yahoo/io/ByteWriter.java1
-rw-r--r--vespajlib/src/main/java/com/yahoo/io/FatalErrorHandler.java3
-rw-r--r--vespajlib/src/main/java/com/yahoo/io/GrowableBufferOutputStream.java10
-rw-r--r--vespajlib/src/main/java/com/yahoo/io/IOUtils.java2
-rw-r--r--vespajlib/src/main/java/com/yahoo/io/Utf8ByteWriter.java3
7 files changed, 13 insertions, 10 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/io/AbstractByteWriter.java b/vespajlib/src/main/java/com/yahoo/io/AbstractByteWriter.java
index e97abe4a80a..a7cb6a9508e 100644
--- a/vespajlib/src/main/java/com/yahoo/io/AbstractByteWriter.java
+++ b/vespajlib/src/main/java/com/yahoo/io/AbstractByteWriter.java
@@ -16,8 +16,7 @@ import java.nio.charset.CharsetEncoder;
* @author Steinar Knutsen
* @author baldersheim
*/
-public abstract class AbstractByteWriter extends GenericWriter implements
- WritableByteTransmitter {
+public abstract class AbstractByteWriter extends GenericWriter implements WritableByteTransmitter {
protected final CharsetEncoder encoder;
protected final BufferChain buffer;
diff --git a/vespajlib/src/main/java/com/yahoo/io/BufferChain.java b/vespajlib/src/main/java/com/yahoo/io/BufferChain.java
index c3dec43764b..cee7a3c25dd 100644
--- a/vespajlib/src/main/java/com/yahoo/io/BufferChain.java
+++ b/vespajlib/src/main/java/com/yahoo/io/BufferChain.java
@@ -18,6 +18,7 @@ import java.util.List;
* @author Steinar Knutsen
*/
public final class BufferChain {
+
// refer to the revision history of ByteWriter for more information about
// the reasons behind the sizing of BUFFERSIZE, WATERMARK and MAXBUFFERS
static final int BUFFERSIZE = 4096;
diff --git a/vespajlib/src/main/java/com/yahoo/io/ByteWriter.java b/vespajlib/src/main/java/com/yahoo/io/ByteWriter.java
index df457990bbe..4bca8ad51f7 100644
--- a/vespajlib/src/main/java/com/yahoo/io/ByteWriter.java
+++ b/vespajlib/src/main/java/com/yahoo/io/ByteWriter.java
@@ -14,6 +14,7 @@ import java.nio.charset.CharsetEncoder;
* @author Steinar Knutsen
*/
public class ByteWriter extends AbstractByteWriter {
+
private final OutputStream stream;
public ByteWriter(final OutputStream stream, final CharsetEncoder encoder) {
diff --git a/vespajlib/src/main/java/com/yahoo/io/FatalErrorHandler.java b/vespajlib/src/main/java/com/yahoo/io/FatalErrorHandler.java
index a491d7ee2cb..1aa84b0a15c 100644
--- a/vespajlib/src/main/java/com/yahoo/io/FatalErrorHandler.java
+++ b/vespajlib/src/main/java/com/yahoo/io/FatalErrorHandler.java
@@ -28,8 +28,8 @@ import java.util.logging.Level;
*
* @author Steinar Knutsen
*/
-
public class FatalErrorHandler {
+
protected static final Logger log = Logger.getLogger(FatalErrorHandler.class.getName());
/**
@@ -48,4 +48,5 @@ public class FatalErrorHandler {
Runtime.getRuntime().halt(1);
}
}
+
}
diff --git a/vespajlib/src/main/java/com/yahoo/io/GrowableBufferOutputStream.java b/vespajlib/src/main/java/com/yahoo/io/GrowableBufferOutputStream.java
index ef598f70175..4b7d2ba4094 100644
--- a/vespajlib/src/main/java/com/yahoo/io/GrowableBufferOutputStream.java
+++ b/vespajlib/src/main/java/com/yahoo/io/GrowableBufferOutputStream.java
@@ -15,12 +15,12 @@ import java.nio.ByteBuffer;
public class GrowableBufferOutputStream extends OutputStream {
private ByteBuffer lastBuffer;
- private ByteBuffer directBuffer;
- private LinkedList<ByteBuffer> bufferList = new LinkedList<>();
- private Stack<ByteBuffer> recycledBuffers = new Stack<>();
+ private final ByteBuffer directBuffer;
+ private final LinkedList<ByteBuffer> bufferList = new LinkedList<>();
+ private final Stack<ByteBuffer> recycledBuffers = new Stack<>();
- private int bufferSize;
- private int maxBuffers;
+ private final int bufferSize;
+ private final int maxBuffers;
public GrowableBufferOutputStream(int bufferSize, int maxBuffers) {
this.bufferSize = bufferSize;
diff --git a/vespajlib/src/main/java/com/yahoo/io/IOUtils.java b/vespajlib/src/main/java/com/yahoo/io/IOUtils.java
index 54cdf5c7b40..81e1306b29e 100644
--- a/vespajlib/src/main/java/com/yahoo/io/IOUtils.java
+++ b/vespajlib/src/main/java/com/yahoo/io/IOUtils.java
@@ -1,7 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.io;
-
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayOutputStream;
@@ -27,7 +26,6 @@ import java.util.List;
import java.nio.charset.Charset;
import java.nio.ByteBuffer;
-
/**
* Some static io convenience methods.
*
diff --git a/vespajlib/src/main/java/com/yahoo/io/Utf8ByteWriter.java b/vespajlib/src/main/java/com/yahoo/io/Utf8ByteWriter.java
index c4cf25f34a0..30ad4aefd09 100644
--- a/vespajlib/src/main/java/com/yahoo/io/Utf8ByteWriter.java
+++ b/vespajlib/src/main/java/com/yahoo/io/Utf8ByteWriter.java
@@ -7,11 +7,13 @@ import java.io.IOException;
import java.nio.ByteBuffer;
public class Utf8ByteWriter extends AbstractByteWriter {
+
private ByteBuffer myBuf;
public Utf8ByteWriter(int initialBuffer) {
super(Utf8.getNewEncoder());
myBuf = ByteBuffer.allocate(initialBuffer);
}
+
@Override
public void send(ByteBuffer src) throws IOException {
if (myBuf.remaining() < src.remaining()) {
@@ -36,6 +38,7 @@ public class Utf8ByteWriter extends AbstractByteWriter {
/**
* Return a buffer ready for read. Must only be called after writer has been closed.
+ *
* @return A flipped ByteBuffer
*/
public ByteBuffer getBuf() {