File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Urgent General Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Urgent General Help" Watch "Urgent General Help" New topic

Urgent General Help

Sameer Shaikh

Joined: Aug 17, 2001
Posts: 1
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

Joined: Jul 13, 2001
Posts: 12
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;

check it out for urself:
just type "javap java.lang.String |more" at the command prompt
I agree. Here's the link:
subject: Urgent General Help
It's not a secret anymore!