zookeeper-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] TisonKun commented on a change in pull request #1023: ZOOKEEPER-3468: Enable BookKeeper checkstyle configuration on zookeeper-jute
Date Thu, 25 Jul 2019 06:06:29 GMT
TisonKun commented on a change in pull request #1023: ZOOKEEPER-3468: Enable BookKeeper checkstyle
configuration on zookeeper-jute
URL: https://github.com/apache/zookeeper/pull/1023#discussion_r307127859
 
 

 ##########
 File path: zookeeper-jute/src/main/java/org/apache/jute/BinaryInputArchive.java
 ##########
 @@ -22,108 +22,124 @@
 import java.io.DataInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
 
 /**
  *
  */
 public class BinaryInputArchive implements InputArchive {
-    static public final String UNREASONBLE_LENGTH= "Unreasonable length = ";
+
+    public static final String UNREASONBLE_LENGTH = "Unreasonable length = ";
+    public static final int MAX_BUFFER = Integer.getInteger("jute.maxbuffer", 0xfffff);
+
     private DataInput in;
-    
-    static public BinaryInputArchive getArchive(InputStream strm) {
+
+    public static BinaryInputArchive getArchive(InputStream strm) {
         return new BinaryInputArchive(new DataInputStream(strm));
     }
-    
-    static private class BinaryIndex implements Index {
+
+    private static class BinaryIndex implements Index {
         private int nelems;
+
         BinaryIndex(int nelems) {
             this.nelems = nelems;
         }
+
         public boolean done() {
             return (nelems <= 0);
         }
+
         public void incr() {
             nelems--;
         }
     }
-    /** Creates a new instance of BinaryInputArchive */
+
+    /**
+     * Creates a new instance of BinaryInputArchive.
+     */
     public BinaryInputArchive(DataInput in) {
         this.in = in;
     }
-    
+
     public byte readByte(String tag) throws IOException {
         return in.readByte();
     }
-    
+
     public boolean readBool(String tag) throws IOException {
         return in.readBoolean();
     }
-    
+
     public int readInt(String tag) throws IOException {
         return in.readInt();
     }
-    
+
     public long readLong(String tag) throws IOException {
         return in.readLong();
     }
-    
+
     public float readFloat(String tag) throws IOException {
         return in.readFloat();
     }
-    
+
     public double readDouble(String tag) throws IOException {
         return in.readDouble();
     }
-    
+
     public String readString(String tag) throws IOException {
-    	int len = in.readInt();
-    	if (len == -1) return null;
+        int len = in.readInt();
+        if (len == -1) {
+            return null;
+        }
         checkLength(len);
-    	byte b[] = new byte[len];
-    	in.readFully(b);
-    	return new String(b, "UTF8");
+        byte[] b = new byte[len];
+        in.readFully(b);
+        return new String(b, StandardCharsets.UTF_8);
     }
-    
-    static public final int maxBuffer = Integer.getInteger("jute.maxbuffer", 0xfffff);
 
 Review comment:
   Yes, I will update.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message