I hava a problem in encoding what I want is , I want to get a enocded value of a String in string format example: "vas" ----------->"diklildnSIikaOMh" Has anyone done this ?if so Please give me some details
There are many ways to do this, in general you could get a ByteOutputStream, wrap it in an ObjectOutputStream, send the String to the OOS, read the bytes from the BOS then convert to a String representation (eg Base64 encode), but this doesn't give the output you specified. (I got 'rO0ABXQAA3Zhcw==')
but stil I have problem in implemetation, I would be greatefull if you help me more , because Im weak in Streams pls
I could not find any read method for BOS in API and also I think BOS mean ByteArrayOutputStream following think ,I have done and I donnt how to read and convert, because there no read method in the API ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject("vas"); Thanks kavi
Have a look at the API for the BOS to see how to read the bytes. Once you have the bytes, you need to convert it into a string form (I'm assuming). I chose Base64 encoding since it is fairly common, and used the 'unsupported Sun implementation', if you search the web you should be able to find a free implentation to use.