This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fury-site.git
The following commit(s) were added to refs/heads/main by this push:
new b67df013 Update index.tsx
b67df013 is described below
commit b67df013a13c5dc88efec1ca72d258f86e3ceb4f
Author: Shawn Yang <[email protected]>
AuthorDate: Wed Oct 9 07:44:59 2024 +0800
Update index.tsx
---
src/components/HomepageCode/index.tsx | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/components/HomepageCode/index.tsx
b/src/components/HomepageCode/index.tsx
index 972dad9d..147b801f 100644
--- a/src/components/HomepageCode/index.tsx
+++ b/src/components/HomepageCode/index.tsx
@@ -9,20 +9,24 @@ import java.util.Arrays;
import org.apache.fury.*;
public class Example {
- public static void main(String[] args) {
- SomeClass object = new SomeClass();
- // Note that Fury instances should be reused between
- // multiple serializations of different objects.
- Fury fury = Fury.builder().withLanguage(Language.JAVA)
- // Allow to deserialize objects unknown types,
- // more flexible but less secure.
- // .withSecureMode(false)
- .build();
+ // Note that Fury instances should be reused between
+ // multiple serializations of different objects.
+ static ThreadSafeFury fury = Fury.builder().withLanguage(Language.JAVA)
+ // Allow to deserialize objects unknown types,
+ // more flexible but less secure.
+ // .withSecureMode(false)
+ .buildThreadSafeFury();
+
+ static {
// Registering types can reduce class name serialization
// overhead but not mandatory.
// If secure mode enabled
//all custom types must be registered.
fury.register(SomeClass.class);
+ }
+
+ public static void main(String[] args) {
+ SomeClass object = new SomeClass();
byte[] bytes = fury.serialize(object);
System.out.println(fury.deserialize(bytes));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]