I couldn’t find any documentation about this…
I want to write to a file a bunch of char and make sure that the file’s size is # of chars bytes.
does anyone know what class to use?
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.
Okay – so you need to pick an encoding which only uses a single byte per character, such as ISO-8859-1. Create a
FileOutputStream, wrap it in anOutputStreamWriterspecifying the encoding, and you’re away. However, you need to be aware that you’re limiting the range of characters which can be represented in your file.