You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Pratik Thacker <pr...@gmail.com> on 2016/08/17 11:41:19 UTC
Binary Data Structure Marshalling and Unmarshalling
We need to decode and encode binary data structure.
We explored several data formats available in
http://camel.apache.org/data-format.html. But couldn't find relevant data
format for binary structured record.
For example:
If my data structure of a record is like:
SampleStructure bytes(12){
int num1: bytes(1);
int num2: bytes(2);
string results: bytes(9);
}
And Data is like:
Record-1{
num1: 100;
num2: 300;
results: "Test_Test";
}
For above sample data, file would be of 12 bytes containing one record.
* 1st byte representing byte form of integer 100.
* 2nd and 3rd byte representing byte form of integer 300. Here, it would be
great if we have choice to choose among big-endian and little-endian format.
* next 9 bytes representing byte form of ascii value of each character of
the string "Test_Test".
Similarly a file can contain multiple consecutive records.
Please suggest if we can unmarshal such formats and directly get a POJO
object, just like we get it for the csv, xml or flat file formats. Here are
the references we already explored and found it to be non-relevant for our
case.
1. Bindy : http://camel.apache.org/bindy.html
2. Bean IO: http://camel.apache.org/beanio.html
3. Flatpack : http://camel.apache.org/flatpack-dataformat.html
--
View this message in context: http://camel.465427.n5.nabble.com/Binary-Data-Structure-Marshalling-and-Unmarshalling-tp5786529.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Binary Data Structure Marshalling and Unmarshalling
Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
If the data formats you’ve listed don’t work, I’d guess you’ll need to write your own DataFormat (http://camel.apache.org/custom-dataformat.html <http://camel.apache.org/custom-dataformat.html>)
> On Aug 17, 2016, at 5:41 AM, Pratik Thacker <pr...@gmail.com> wrote:
>
> We need to decode and encode binary data structure.
> We explored several data formats available in
> http://camel.apache.org/data-format.html. But couldn't find relevant data
> format for binary structured record.
>
> For example:
> If my data structure of a record is like:
> SampleStructure bytes(12){
> int num1: bytes(1);
> int num2: bytes(2);
> string results: bytes(9);
> }
> And Data is like:
> Record-1{
> num1: 100;
> num2: 300;
> results: "Test_Test";
> }
> For above sample data, file would be of 12 bytes containing one record.
> * 1st byte representing byte form of integer 100.
> * 2nd and 3rd byte representing byte form of integer 300. Here, it would be
> great if we have choice to choose among big-endian and little-endian format.
> * next 9 bytes representing byte form of ascii value of each character of
> the string "Test_Test".
>
> Similarly a file can contain multiple consecutive records.
>
> Please suggest if we can unmarshal such formats and directly get a POJO
> object, just like we get it for the csv, xml or flat file formats. Here are
> the references we already explored and found it to be non-relevant for our
> case.
> 1. Bindy : http://camel.apache.org/bindy.html
> 2. Bean IO: http://camel.apache.org/beanio.html
> 3. Flatpack : http://camel.apache.org/flatpack-dataformat.html
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Binary-Data-Structure-Marshalling-and-Unmarshalling-tp5786529.html
> Sent from the Camel - Users mailing list archive at Nabble.com.