Class PTZInstructionSerializer
java.lang.Object
io.github.lunasaw.gb28181.common.entity.control.instruction.serializer.PTZInstructionSerializer
PTZ指令序列化器
提供多种序列化/反序列化方式
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum序列化格式枚举static interface序列化函数接口 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PTZInstructionFormatdeserializeFromBase64(String base64String) 从Base64字符串反序列化static PTZInstructionFormatdeserializeFromByteBuffer(ByteBuffer buffer) 从ByteBuffer反序列化static PTZInstructionFormatdeserializeFromBytes(byte[] bytes) 从字节数组反序列化static PTZInstructionFormatdeserializeFromHex(String hexString) 从十六进制字符串反序列化static PTZInstructionFormatdeserializeFromObjectStream(byte[] bytes) 从Java对象流反序列化static StringserializeToBase64(PTZInstructionFormat instruction) 序列化为Base64字符串static ByteBufferserializeToByteBuffer(PTZInstructionFormat instruction) 序列化为紧凑的字节缓冲区static byte[]serializeToBytes(PTZInstructionFormat instruction) 序列化为字节数组static StringserializeToHex(PTZInstructionFormat instruction) 序列化为十六进制字符串static byte[]serializeToObjectStream(PTZInstructionFormat instruction) 序列化为Java对象流static booleanvalidateSerialization(PTZInstructionFormat original, Object serialized, PTZInstructionSerializer.SerializationFunction<Object, PTZInstructionFormat> deserializer) 验证序列化的完整性
-
Constructor Details
-
PTZInstructionSerializer
public PTZInstructionSerializer()
-
-
Method Details
-
serializeToBytes
序列化为字节数组- Parameters:
instruction- PTZ指令- Returns:
- 字节数组
-
deserializeFromBytes
从字节数组反序列化- Parameters:
bytes- 字节数组- Returns:
- PTZ指令
-
serializeToHex
序列化为十六进制字符串- Parameters:
instruction- PTZ指令- Returns:
- 十六进制字符串
-
deserializeFromHex
从十六进制字符串反序列化- Parameters:
hexString- 十六进制字符串- Returns:
- PTZ指令
-
serializeToBase64
序列化为Base64字符串- Parameters:
instruction- PTZ指令- Returns:
- Base64字符串
-
deserializeFromBase64
从Base64字符串反序列化- Parameters:
base64String- Base64字符串- Returns:
- PTZ指令
-
serializeToObjectStream
序列化为Java对象流- Parameters:
instruction- PTZ指令- Returns:
- 序列化后的字节数组
- Throws:
IOException- 序列化异常
-
deserializeFromObjectStream
public static PTZInstructionFormat deserializeFromObjectStream(byte[] bytes) throws IOException, ClassNotFoundException 从Java对象流反序列化- Parameters:
bytes- 序列化的字节数组- Returns:
- PTZ指令
- Throws:
IOException- 反序列化异常ClassNotFoundException- 类未找到异常
-
serializeToByteBuffer
序列化为紧凑的字节缓冲区- Parameters:
instruction- PTZ指令- Returns:
- ByteBuffer
-
deserializeFromByteBuffer
从ByteBuffer反序列化- Parameters:
buffer- ByteBuffer- Returns:
- PTZ指令
-
validateSerialization
public static boolean validateSerialization(PTZInstructionFormat original, Object serialized, PTZInstructionSerializer.SerializationFunction<Object, PTZInstructionFormat> deserializer) 验证序列化的完整性- Parameters:
original- 原始指令serialized- 序列化后的数据deserializer- 反序列化函数- Returns:
- 是否一致
-