how does one get an existing .class file in a byteBuffer?

E

enzo.660

hey!

how does one get an existing .class file in a byteBuffer? and can I
then convert it into stringBuffer?

Thanks!
 
A

Alex Hunsley

hey!

how does one get an existing .class file in a byteBuffer?

Well, by loading the class file into a ByteBuffer.
I'm not being funny here, I'm just not sure what you're asking exactly.
and can I
then convert it into stringBuffer?

Well, you could try, but why would you want to? What are you trying to
do here? You would end up with a string of garbage.
 
O

Oliver Wong

Alex Hunsley said:
Well, by loading the class file into a ByteBuffer.
I'm not being funny here, I'm just not sure what you're asking exactly.

In other words, there's no sign that the fact that the files you're
dealing with are "class" files is of any relevance. I.e. a solution which
loads "normal" files into bytebuffer should work just as well with "class"
files. So google for a tutorial on file I/O in Java.
Well, you could try, but why would you want to? What are you trying to
do here? You would end up with a string of garbage.

And different garbage depending on which encoding you use to interpret
the byte stream. Unlike C, bytes and characters are completely different
things in Java.

- Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top