Package org.epics.pvdata.misc
Class SerializeHelper
- java.lang.Object
-
- org.epics.pvdata.misc.SerializeHelper
-
public final class SerializeHelper extends Object
Serialization helper.
-
-
Constructor Summary
Constructors Constructor Description SerializeHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringdeserializeString(ByteBuffer buffer)Deserialize a string from the specified buffer.static StringdeserializeString(ByteBuffer buffer, DeserializableControl control)Deserialize a string from the specified buffer.static intreadSize(ByteBuffer buffer)Deserialize the array size from the specified buffer.static intreadSize(ByteBuffer buffer, DeserializableControl control)Deserialize the array size from the specified buffer.static voidserializeString(String value, ByteBuffer buffer)Serialize the specified string into the specified buffer.static voidserializeString(String value, ByteBuffer buffer, SerializableControl flusher)Serialize the specified string into the specified buffer, flushing when necessary.static voidserializeSubstring(String value, int offset, int count, ByteBuffer buffer, SerializableControl flusher)Serialize a substring of a specified string into the specified buffer, flushing when necessary.static voidwriteSize(int s, ByteBuffer buffer, SerializableControl flusher)Serialize the specified array size into the specified buffer, flushing when necessary.
-
-
-
Method Detail
-
writeSize
public static final void writeSize(int s, ByteBuffer buffer, SerializableControl flusher)Serialize the specified array size into the specified buffer, flushing when necessary. The specified SerializableControl manages any flushing required.- Parameters:
s- size to encodebuffer- the buffer to be serialized intoflusher- the SerializableControl to manage the flushing
-
readSize
public static final int readSize(ByteBuffer buffer, DeserializableControl control)
Deserialize the array size from the specified buffer. The specified DeserializableControl ensures sufficient bytes are available.- Parameters:
buffer- the buffer to serialize fromcontrol- the DeserializableControl- Returns:
- the deserialized array size
-
readSize
public static final int readSize(ByteBuffer buffer)
Deserialize the array size from the specified buffer.- Parameters:
buffer- the buffer to serialize from- Returns:
- the deserialized array size
-
serializeString
public static final void serializeString(String value, ByteBuffer buffer, SerializableControl flusher)
Serialize the specified string into the specified buffer, flushing when necessary. The specified SerializableControl manages any flushing required.- Parameters:
value- the string to be serializedbuffer- the buffer to be serialized intoflusher- the SerializableControl to manage the flushing
-
serializeString
public static final void serializeString(String value, ByteBuffer buffer)
Serialize the specified string into the specified buffer.- Parameters:
value- the string to be serializedbuffer- the buffer to be serialized into
-
serializeSubstring
public static final void serializeSubstring(String value, int offset, int count, ByteBuffer buffer, SerializableControl flusher)
Serialize a substring of a specified string into the specified buffer, flushing when necessary. The substring serialized is of the specified length and starts at the specified offset relative to supplied string. The specified SerializableControl manages any flushing required.- Parameters:
value- the string from which a substring is to be serializedoffset- the start of the substring relative to supplied stringcount- the length of the substringbuffer- the buffer to be serialized intoflusher- the SerializableControl to manage the flushing
-
deserializeString
public static final String deserializeString(ByteBuffer buffer, DeserializableControl control)
Deserialize a string from the specified buffer. The specified DeserializableControl ensures sufficient bytes are available.- Parameters:
buffer- the buffer to serialize fromcontrol- the DeserializableControl- Returns:
- the deserialized string
-
deserializeString
public static final String deserializeString(ByteBuffer buffer)
Deserialize a string from the specified buffer.- Parameters:
buffer- the buffer to serialize from- Returns:
- the deserialized string
-
-