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.

@FunctionalInterface public interface BytecodeDeserializer
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: