Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KaitaiStream is abstract? #565

Closed
cgivre opened this issue Apr 15, 2019 · 7 comments
Closed

KaitaiStream is abstract? #565

cgivre opened this issue Apr 15, 2019 · 7 comments

Comments

@cgivre
Copy link

cgivre commented Apr 15, 2019

I've been trying out Kaitai Structs and it looks very impressive. However, I'm getting an error:

I copied the code directly from your site:

DnsPacket data = new DnsPacket(new KaitaiStream(dns_bytes));

However, when I try to build this, I get the following error:

java:[53,77] error: KaitaiStream is abstract; cannot be instantiated

I'm not a great Java developer, but it seems like this should work. Any suggestions?
I am using Kaitai version 0.8.

@GreyCat
Copy link
Member

GreyCat commented Apr 15, 2019

Hmm, good catch, thanks for reporting it. Actually, code samples on https://formats.kaitai.io for Java seem to be outdated. Currently there are two implementations of KaitaiStream. You can try

DnsPacket data = new DnsPacket(new ByteBufferKaitaiStream(dns_bytes));

@cgivre
Copy link
Author

cgivre commented Apr 16, 2019

Thanks for the help! Just another suggestion, as a n00b Java person, it would be really helpful as well if you included the imports for a maven or gradle project. It took me quite a while to figure out what exactly had to be included as a dependency.

@GreyCat
Copy link
Member

GreyCat commented Apr 16, 2019

it would be really helpful as well if you included the imports for a maven or gradle project.

Does http://doc.kaitai.io/lang_java.html#_installation answer that question?

@cgivre
Copy link
Author

cgivre commented Apr 16, 2019

Yes it does. Thanks! Should I close this ticket?

@GreyCat
Copy link
Member

GreyCat commented Apr 16, 2019

I'll fix the formats intro generation and will close it.

GreyCat added a commit to kaitai-io/kaitai_struct_formats that referenced this issue Apr 16, 2019
@GreyCat
Copy link
Member

GreyCat commented Apr 16, 2019

Actually, that second question raises a more complex concern: looks like it's not obvious that runtime should be installed before using this format, and people tends to miss runtime installation docs. I wonder what would be the best way to expose it, without adding too much scary boilerplate in these format usage intros...

@GreyCat
Copy link
Member

GreyCat commented Apr 21, 2019

Forked that "more complex concern" in separate issue #571. This one is resolved.

@GreyCat GreyCat closed this as completed Apr 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants