Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Urgent General Help

 
Sameer Shaikh
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one tell me i want to write a string using the FileOutputStream the write method takes a byte[] as parameter can any one tell me whether any other possible way to write the string in the file , or any method which converts String to Byte[] .
------------------
 
syed fazal faheem
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You can convert string into an array of bytes using the following methods in String class:
1. public byte getBytes()[];
2. public void getBytes(int, int, byte[], int);
3. public byte getBytes(java.lang.String)[] throws java.io.UnsupportedEncodingException;

check it out for urself:
just type "javap java.lang.String |more" at the command prompt
bye
fazal.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic