Interface BytecodeDeserializer
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Represents a class that can deserialize constants from a byte stream.
A BytecodeSerializer
establishes a byte encoding for objects. The
BytecodeDeserializer
used to deserialize an interpreter should follow the same encoding.
For example:
public class MyBytecodeDeserializer implements BytecodeDeserializer { @Override public Object deserialize(DeserializerContext context, DataInput buffer) throws IOException { byte objectCode = buffer.readByte(); return switch (objectCode) { case 1 -> buffer.readLong(); case 2 -> buffer.readUTF(); case ... } } }
- Since:
- 24.2
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Interface for a generated class that can deserialize aBytecodeRootNode
from a byte input. -
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(BytecodeDeserializer.DeserializerContext context, DataInput buffer) The deserialization process.
-
Method Details
-
deserialize
Object deserialize(BytecodeDeserializer.DeserializerContext context, DataInput buffer) throws IOException The deserialization process. Anobject
should be decoded from thebuffer
and returned.The
context
is supplied so that aBytecodeDeserializer
can transitively deserialize otherroot nodes
(e.g., inner functions) if necessary.Must be idempotent.
- Throws:
IOException
- Since:
- 24.2
-