chaokunyang commented on code in PR #1565:
URL: https://github.com/apache/incubator-fury/pull/1565#discussion_r1577942402


##########
java/fury-core/src/main/java/org/apache/fury/meta/MetaStringDecoder.java:
##########
@@ -66,30 +65,36 @@ public String decode(byte[] encodedData, Encoding encoding, 
int numBits) {
   }
 
   /** Decoding method for {@link Encoding#LOWER_SPECIAL}. */
-  private String decodeLowerSpecial(byte[] data, int numBits) {
+  private String decodeLowerSpecial(byte[] data) {
     StringBuilder decoded = new StringBuilder();
-    int bitIndex = 0;
-    int bitMask = 0b11111; // 5 bits for mask
-    while (bitIndex + 5 <= numBits) {
+    int totalBits = data.length * 8; // Total number of bits in the data
+    boolean stripLastChar = (data[0] & 0x80) != 0; // Check the first bit of 
the first byte
+    int bitMask = 0b11111; // 5 bits for the mask
+    int bitIndex = 1; // Start from the second bit
+    while (bitIndex + 5 <= totalBits) {

Review Comment:
   Yes, since one char is encoded using `5/6` chars, the last byte may have 
`1~7` rebundant bits, which can hold another char, and we must delete such char



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to