MCPcopy Create free account
hub / github.com/MailCore/mailcore2 / NativeObject

Class NativeObject

src/java/com/libmailcore/NativeObject.java:8–44  ·  view source on GitHub ↗

Native C++ Object wrapper.

Source from the content-addressed store, hash-verified

6
7/** Native C++ Object wrapper. */
8public class NativeObject implements Cloneable, Serializable {
9 protected void finalize() throws Throwable
10 {
11 super.finalize();
12 unsetupNative();
13 }
14
15 protected native void initWithNative(long nativeHandle);
16 private native void unsetupNative();
17 /** Returns a string representing the object. */
18 public native String toString();
19 /** Create a copy of the object. */
20 public native Object clone() throws CloneNotSupportedException;
21
22 private long nativeHandle;
23
24 private static final long serialVersionUID = 1L;
25
26 protected void writeObject(java.io.ObjectOutputStream out) throws IOException {
27 byte[] data = serializableData();
28 out.writeInt(data.length);
29 out.write(data, 0, data.length);
30 }
31
32 protected void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
33 int len = in.readInt();
34 byte[] data = new byte[len];
35 in.read(data, 0, len);
36 }
37
38 private native byte[] serializableData();
39 private native void importSerializableData(byte[] data);
40
41 static {
42 MainThreadUtils.singleton();
43 }
44}

Callers

nothing calls this directly

Calls 1

singletonMethod · 0.95

Tested by

no test coverage detected