This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Urgent General Help  RSS feed

 
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
Boost this thread!