Skip to content

Latest commit

 

History

History
39 lines (32 loc) · 883 Bytes

README.md

File metadata and controls

39 lines (32 loc) · 883 Bytes

pvDataNativeJava

This project implements pvData serialization using POJOs, instead of pvData PV container classes. pvData introspection interface classes and mechanism where replaced by using Java Reflection API.

Usage:

  • first define a simple Java POJO class:
public static class MyData
{
	double x, y;
	String name;
	int[] numbers;
}
  • create a new instance and initialze data
	MyData data = new MyData();
	data.x = 12.3;
	data.y = 4.56;
	data.name = "Matej";
	data.numbers = new int[] { 1, 2, 8 };
  • serialize into a buffer
	ByteBuffer buffer = ByteBuffer.allocate(1024);
	PVData.serialize(buffer, data);
  • deserialize (from the same buffer in this example)
	buffer.flip();
	MyData data2 = PVData.deserialize(buffer, MyData.class);

See full example code.