You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kaustubhkane <ka...@tcs.com> on 2016/09/02 13:35:44 UTC

Unmarshal fixed length Binary data

Hi,

We have a fixed length Binary data.

I am looking at the Bindy Data Format and found that it supports
unmarshalling of Fixed Length records. 

I looked at the implementation/code of this Bindy Fixed Lenght records in
the Camel Source code (BindyFixedLengthDataFormat.java and
BindyFixedLengthFactory.java) 

I looked at the function createModel in BindyFixedLengthDataFormat.java and
found that it assumes one record equivalent to one line (i.e. each record
will be in a separate line). Which means at the completion of record there
will be a newline character in the file so that next record starts from a
new line. 

For this reason, it seems to me that Bindy Data Format will not be able to
unmarshal fixed lenght binary data. In Binary mode files there are no lines
and rows. You don't read in lines in case of binary data/files. That only
works with text files.

Could someone please provide details on what Data Format can be used to
unmarshal Fixed lenght binary data??

I am looking at an appropriate data format to which I can provide a model
and using that model it will read the data and create a POJO for me. Just
like what Bindy does. 

Regards,
Kaustubh Kane



--
View this message in context: http://camel.465427.n5.nabble.com/Unmarshal-fixed-length-Binary-data-tp5787125.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Unmarshal fixed length Binary data

Posted by DariusX <da...@gmail.com>.
You write a class need to implement the DataFormat interface. The two key
calls are: marshal() and unmarshal() 
See here: http://camel.apache.org/data-format.html
Looking at the code for some of the existing implementations of DataFormat
should give you some ideas.
For instance, you might come up with some type of annotation that you can
use on your Java POJOs, describing how each of the fields should marshalled
or unmarshalled. Then, your DataFormat implementation could use those
annotations, and thus be quite general. 

Maybe it can be contributed back to the Camel project :)



--
View this message in context: http://camel.465427.n5.nabble.com/Unmarshal-fixed-length-Binary-data-tp5787125p5787603.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Unmarshal fixed length Binary data

Posted by kaustubhkane <ka...@tcs.com>.
Could someone please guide me on creating a custom DataFormat.

Please refer to details in my previous post above. 



--
View this message in context: http://camel.465427.n5.nabble.com/Unmarshal-fixed-length-Binary-data-tp5787125p5787592.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Unmarshal fixed length Binary data

Posted by kaustubhkane <ka...@tcs.com>.
Hello,
I will need to write my own DataFormat. I am trying to understand what all
will be needed. Can I re-use anything within existing DataFormats
functionality which Camel provide.

Following are the main areas to be covered for the new DataFormat.
1) Marshal and unmarshal the binary data from text file to/from POJO

2) Making it model driven by being able to provide the data model in form of
Java annotations which the Camel framework will load to marshal and
unmarshal the data. 

Both of the above areas are covered in the existing DataFormats provided out
of the box by Camel. 

Will I be able to re-use anything for my custom data format ??

Could you please provide brief details on what all you had to do to create a
Custom DataFormat.



--
View this message in context: http://camel.465427.n5.nabble.com/Unmarshal-fixed-length-Binary-data-tp5787125p5787406.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Unmarshal fixed length Binary data

Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
If BeanIO doesn’t work out, you can always write your own DataFormat - I’ve had to do that a few times, and it’s pretty straightforward.

http://camel.apache.org/custom-dataformat.html <http://camel.apache.org/custom-dataformat.html>

> On Sep 7, 2016, at 8:15 AM, kaustubhkane <ka...@tcs.com> wrote:
> 
> Thanks for all your responses. I am looking at the BeanIO data format and
> will get back on this in a day or two.
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Unmarshal-fixed-length-Binary-data-tp5787125p5787306.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Unmarshal fixed length Binary data

Posted by kaustubhkane <ka...@tcs.com>.
Thanks for all your responses. I am looking at the BeanIO data format and
will get back on this in a day or two.



--
View this message in context: http://camel.465427.n5.nabble.com/Unmarshal-fixed-length-Binary-data-tp5787125p5787306.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Unmarshal fixed length Binary data

Posted by Vitalii Tymchyshyn <vi...@tym.im>.
Unfortunatelly beanio do not support binary. It may work if your binary is
a valud UTF-8 (or othet charset) though. E.g. we are parsing copybook with
it.

Пт, 2 вер. 2016 10:55 користувач Brad Johnson <br...@mediadriver.com>
пише:

> I second Beanio. I've used it for fixed length multi-line records and it is
> fabulous.
>
> On Fri, Sep 2, 2016 at 9:28 AM, Quinn Stevenson <
> quinn@pronoia-solutions.com
> > wrote:
>
> > Have you looked at the BeanIO DataFormat? (http://camel.apache.org/
> > beanio.html <http://camel.apache.org/beanio.html>)
> >
> > > On Sep 2, 2016, at 7:35 AM, kaustubhkane <ka...@tcs.com>
> wrote:
> > >
> > > Hi,
> > >
> > > We have a fixed length Binary data.
> > >
> > > I am looking at the Bindy Data Format and found that it supports
> > > unmarshalling of Fixed Length records.
> > >
> > > I looked at the implementation/code of this Bindy Fixed Lenght records
> in
> > > the Camel Source code (BindyFixedLengthDataFormat.java and
> > > BindyFixedLengthFactory.java)
> > >
> > > I looked at the function createModel in BindyFixedLengthDataFormat.java
> > and
> > > found that it assumes one record equivalent to one line (i.e. each
> record
> > > will be in a separate line). Which means at the completion of record
> > there
> > > will be a newline character in the file so that next record starts
> from a
> > > new line.
> > >
> > > For this reason, it seems to me that Bindy Data Format will not be able
> > to
> > > unmarshal fixed lenght binary data. In Binary mode files there are no
> > lines
> > > and rows. You don't read in lines in case of binary data/files. That
> only
> > > works with text files.
> > >
> > > Could someone please provide details on what Data Format can be used to
> > > unmarshal Fixed lenght binary data??
> > >
> > > I am looking at an appropriate data format to which I can provide a
> model
> > > and using that model it will read the data and create a POJO for me.
> Just
> > > like what Bindy does.
> > >
> > > Regards,
> > > Kaustubh Kane
> > >
> > >
> > >
> > > --
> > > View this message in context: http://camel.465427.n5.nabble.
> > com/Unmarshal-fixed-length-Binary-data-tp5787125.html
> > > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
> >
>

Re: Unmarshal fixed length Binary data

Posted by Brad Johnson <br...@mediadriver.com>.
I second Beanio. I've used it for fixed length multi-line records and it is
fabulous.

On Fri, Sep 2, 2016 at 9:28 AM, Quinn Stevenson <quinn@pronoia-solutions.com
> wrote:

> Have you looked at the BeanIO DataFormat? (http://camel.apache.org/
> beanio.html <http://camel.apache.org/beanio.html>)
>
> > On Sep 2, 2016, at 7:35 AM, kaustubhkane <ka...@tcs.com> wrote:
> >
> > Hi,
> >
> > We have a fixed length Binary data.
> >
> > I am looking at the Bindy Data Format and found that it supports
> > unmarshalling of Fixed Length records.
> >
> > I looked at the implementation/code of this Bindy Fixed Lenght records in
> > the Camel Source code (BindyFixedLengthDataFormat.java and
> > BindyFixedLengthFactory.java)
> >
> > I looked at the function createModel in BindyFixedLengthDataFormat.java
> and
> > found that it assumes one record equivalent to one line (i.e. each record
> > will be in a separate line). Which means at the completion of record
> there
> > will be a newline character in the file so that next record starts from a
> > new line.
> >
> > For this reason, it seems to me that Bindy Data Format will not be able
> to
> > unmarshal fixed lenght binary data. In Binary mode files there are no
> lines
> > and rows. You don't read in lines in case of binary data/files. That only
> > works with text files.
> >
> > Could someone please provide details on what Data Format can be used to
> > unmarshal Fixed lenght binary data??
> >
> > I am looking at an appropriate data format to which I can provide a model
> > and using that model it will read the data and create a POJO for me. Just
> > like what Bindy does.
> >
> > Regards,
> > Kaustubh Kane
> >
> >
> >
> > --
> > View this message in context: http://camel.465427.n5.nabble.
> com/Unmarshal-fixed-length-Binary-data-tp5787125.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Re: Unmarshal fixed length Binary data

Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
Have you looked at the BeanIO DataFormat? (http://camel.apache.org/beanio.html <http://camel.apache.org/beanio.html>)

> On Sep 2, 2016, at 7:35 AM, kaustubhkane <ka...@tcs.com> wrote:
> 
> Hi,
> 
> We have a fixed length Binary data.
> 
> I am looking at the Bindy Data Format and found that it supports
> unmarshalling of Fixed Length records. 
> 
> I looked at the implementation/code of this Bindy Fixed Lenght records in
> the Camel Source code (BindyFixedLengthDataFormat.java and
> BindyFixedLengthFactory.java) 
> 
> I looked at the function createModel in BindyFixedLengthDataFormat.java and
> found that it assumes one record equivalent to one line (i.e. each record
> will be in a separate line). Which means at the completion of record there
> will be a newline character in the file so that next record starts from a
> new line. 
> 
> For this reason, it seems to me that Bindy Data Format will not be able to
> unmarshal fixed lenght binary data. In Binary mode files there are no lines
> and rows. You don't read in lines in case of binary data/files. That only
> works with text files.
> 
> Could someone please provide details on what Data Format can be used to
> unmarshal Fixed lenght binary data??
> 
> I am looking at an appropriate data format to which I can provide a model
> and using that model it will read the data and create a POJO for me. Just
> like what Bindy does. 
> 
> Regards,
> Kaustubh Kane
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Unmarshal-fixed-length-Binary-data-tp5787125.html
> Sent from the Camel - Users mailing list archive at Nabble.com.