Skip to content

Commit

Permalink
feat(java): Refactor String serialization and deserialization (#1890)
Browse files Browse the repository at this point in the history
## What does this PR do?

<!-- Describe the purpose of this PR. -->

## Related issues

Closes #1868
Closes #1754

## Does this PR introduce any user-facing change?

<!--
If any user-facing interface changes, please [open an
issue](https://github.com/apache/fury/issues/new/choose) describing the
need to do so and update the document if necessary.
-->

- [ ] Does this PR introduce any public API change?
- [ ] Does this PR introduce any binary protocol compatibility change?

## Benchmark

<!--
When the PR has an impact on performance (if you don't know whether the
PR will have an impact on performance, you can submit the PR first, and
if it will have impact on performance, the code reviewer will explain
it), be sure to attach a benchmark data here.
-->

---------

Co-authored-by: chaokunyang <[email protected]>
  • Loading branch information
HuangXingBo and chaokunyang authored Oct 21, 2024
1 parent 750a511 commit 09abde8
Show file tree
Hide file tree
Showing 9 changed files with 868 additions and 178 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public final class FuryBuilder {
ClassLoader classLoader;
boolean compressInt = true;
public LongEncoding longEncoding = LongEncoding.SLI;
boolean compressString = true;
boolean compressString = false;
CompatibleMode compatibleMode = CompatibleMode.SCHEMA_CONSISTENT;
boolean checkJdkClassSerializable = true;
Class<? extends Serializer> defaultJDKStreamSerializerType = ObjectStreamSerializer.class;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ private int _unsafeGetInt32(int index) {
}

// CHECKSTYLE.OFF:MethodName
private void _unsafePutInt32(int index, int value) {
public void _unsafePutInt32(int index, int value) {
// CHECKSTYLE.ON:MethodName
if (!LITTLE_ENDIAN) {
value = Integer.reverseBytes(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public void write(MemoryBuffer buffer, T value) {
} else {
char[] v = (char[]) GET_VALUE.apply(value);
if (StringUtils.isLatin(v)) {
stringSerializer.writeCharsLatin(buffer, v, value.length());
stringSerializer.writeCharsLatin1(buffer, v, value.length());
} else {
stringSerializer.writeCharsUTF16(buffer, v, value.length());
}
Expand Down
Loading

0 comments on commit 09abde8

Please sign in to comment.