I have a FloatBuffer of known size and just want to dump the data to a file (in binary) for inspection outside my app. What’s the easiest way to do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
UPDATE FOR BINARY OUTPUT:
TEXT OUTPUT: Since you want this to be viewable I assume you want a text file. You’ll want to use a PrintStream.
Didn’t have time to post a full raw/binary (non-text) version of this. If you want to do that use a FileOutputStream, get the FileChannel, and directly write the FloatBuffer (since it’s a ByteBuffer)