Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ public String readString(MemoryBuffer buffer) {
public Expression readStringExpr(Expression strSerializer, Expression buffer) {
if (isJava) {
if (STRING_VALUE_FIELD_IS_BYTES) {
return new Invoke(strSerializer, "readBytesString", STRING_TYPE, buffer);
if (compressString) {
return new Invoke(strSerializer, "readCompressedBytesString", STRING_TYPE, buffer);
} else {
return new Invoke(strSerializer, "readBytesString", STRING_TYPE, buffer);
}
} else {
if (!STRING_VALUE_FIELD_IS_CHARS) {
throw new UnsupportedOperationException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentLinkedQueue;
import lombok.Data;
import org.apache.fury.Fury;
import org.apache.fury.FuryTestBase;
import org.apache.fury.collection.Tuple2;
Expand Down Expand Up @@ -160,6 +161,35 @@ public void testJavaStringSimple() {
}
}

@Data
public static class Simple {
private String str;

public Simple(String str) {
this.str = str;
}
}

/** Test for <a href="https://github.com/apache/fury/issues/1984">#1984</a> */
@Test
public void testJavaCompressedString() {
Fury fury =
Fury.builder()
.withStringCompressed(true)
.withLanguage(Language.JAVA)
.requireClassRegistration(false)
.build();

Simple a =
new Simple(
"STG@ON DEMAND Solutions@GeoComputing Switch/ Hub@Digi Edgeport/216 – 16 port Serial Hub");

byte[] bytes = fury.serialize(a);

Simple b = (Simple) fury.deserialize(bytes);
assertEquals(a, b);
}

@Test(dataProvider = "stringCompress")
public void testJavaString(boolean stringCompress) {
Fury fury =
Expand Down
Loading