Top Fields Constructors Methods
org.graalvm.nativebridge

pack-priv final Class NullableBinaryMarshaller<T>

extends Object
implements BinaryMarshaller<T>
Class Inheritance
All Implemented Interfaces
org.graalvm.nativebridge.BinaryMarshaller

Field Summary

Modifier and TypeField and Description
private final BinaryMarshaller<T>
private static final byte
private static final byte

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int
inferSize(T object)

Overrides default org.graalvm.nativebridge.BinaryMarshaller.inferSize.

Estimates a size in bytes needed to marshall given object.

public int
inferUpdateSize(T object)

Overrides default org.graalvm.nativebridge.BinaryMarshaller.inferUpdateSize.

Estimates a size in bytes needed to marshall Out parameter passed back to caller from a foreign method call.

public T
read(BinaryInput input)

Implements org.graalvm.nativebridge.BinaryMarshaller.read.

Deserializes and recreates an object passed to a foreign method.

public void
readUpdate(BinaryInput input, T object)

Overrides default org.graalvm.nativebridge.BinaryMarshaller.readUpdate.

Deserializes and updates the mutable state of a given object to support Out semantics.

public void
write(BinaryOutput output, T object)

Implements org.graalvm.nativebridge.BinaryMarshaller.write.

Decomposes and serializes the given object passed to a foreign method.

public void
writeUpdate(BinaryOutput output, T object)

Overrides default org.graalvm.nativebridge.BinaryMarshaller.writeUpdate.

Decomposes and serializes the mutable state of a given object to support Out semantics.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
private final BinaryMarshaller<T> delegate
NON_NULLback to summary
private static final byte NON_NULL
NULLback to summary
private static final byte NULL

Constructor Detail

NullableBinaryMarshallerback to summary
pack-priv NullableBinaryMarshaller(BinaryMarshaller<T> delegate)

Method Detail

inferSizeback to summary
public int inferSize(T object)

Overrides default org.graalvm.nativebridge.BinaryMarshaller.inferSize.

Doc from org.graalvm.nativebridge.BinaryMarshaller.inferSize.

Estimates a size in bytes needed to marshall given object. The returned value is used to pre-allocate the BinaryOutput's buffer. The accuracy of the estimate affects the speed of marshalling. If the estimate is too small, the pre-allocated buffer must be re-allocated and the already marshalled data must be copied. Too large a value may cause the static buffer to be unused and the dynamic buffer to be unnecessarily allocated.

Annotations
@Override
inferUpdateSizeback to summary
public int inferUpdateSize(T object)

Overrides default org.graalvm.nativebridge.BinaryMarshaller.inferUpdateSize.

Doc from org.graalvm.nativebridge.BinaryMarshaller.inferUpdateSize.

Estimates a size in bytes needed to marshall Out parameter passed back to caller from a foreign method call. The accuracy of the estimate affects the speed of marshalling. If the estimate is too small, the pre-allocated buffer must be re-allocated and the already marshalled data must be copied. Too large a value may cause the static buffer to be unused and the dynamic buffer to be unnecessarily allocated. Marshallers that do not support Out parameters do not need to implement this method. The default implementation throws UnsupportedOperationException. To support Out parameters the BinaryMarshaller must implement also writeUpdate(BinaryOutput, Object) and readUpdate(BinaryInput, Object).

Annotations
@Override
readback to summary
public T read(BinaryInput input)

Implements org.graalvm.nativebridge.BinaryMarshaller.read.

Doc from org.graalvm.nativebridge.BinaryMarshaller.read.

Deserializes and recreates an object passed to a foreign method.

Annotations
@Override
readUpdateback to summary
public void readUpdate(BinaryInput input, T object)

Overrides default org.graalvm.nativebridge.BinaryMarshaller.readUpdate.

Doc from org.graalvm.nativebridge.BinaryMarshaller.readUpdate.

Deserializes and updates the mutable state of a given object to support Out semantics. Marshallers that do not support Out parameters do not need to implement this method. The default implementation throws UnsupportedOperationException. To support Out parameters the BinaryMarshaller must implement also writeUpdate(BinaryOutput, Object) and inferUpdateSize(Object).

Annotations
@Override
writeback to summary
public void write(BinaryOutput output, T object)

Implements org.graalvm.nativebridge.BinaryMarshaller.write.

Doc from org.graalvm.nativebridge.BinaryMarshaller.write.

Decomposes and serializes the given object passed to a foreign method.

Annotations
@Override
writeUpdateback to summary
public void writeUpdate(BinaryOutput output, T object)

Overrides default org.graalvm.nativebridge.BinaryMarshaller.writeUpdate.

Doc from org.graalvm.nativebridge.BinaryMarshaller.writeUpdate.

Decomposes and serializes the mutable state of a given object to support Out semantics. Marshallers that do not support Out parameters do not need to implement this method. The default implementation throws UnsupportedOperationException. To support Out parameters the BinaryMarshaller must implement also readUpdate(BinaryInput, Object) and inferUpdateSize(Object).

The Out parameters are passed in the following way:

  1. The start point method writes the parameter using write(BinaryOutput, Object).
  2. A foreign method call is made.
  3. The end point method reads the parameter using read(BinaryInput).
  4. The end point receiver method is called with the unmarshalled parameter.
  5. After calling the receiver method, the end point method writes the mutated Out parameter state using writeUpdate(BinaryOutput, Object).
  6. A foreign method returns.
  7. The state of the Out parameter is updated using readUpdate(BinaryInput, Object).

Annotations
@Override