• Post Reply Bookmark Topic Watch Topic
  • New Topic

Byte Problem  RSS feed

 
Animesh Saxena
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to write a 2 byte value 0x8000 to a file

Can I convert it to string and do it as follows

 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to write two bytes to the file (binary), then you should not convert the value to a string. Why do you want to do it like that? Class OutputStream has a write(byte[]) method, so why don't you just use that to write your byte array to the file?

[ January 31, 2007: Message edited by: Jesper Young ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!