Results 1 to 2 of 2
- 11-19-2012, 01:13 PM #1
Member
- Join Date
- Sep 2011
- Posts
- 14
- Rep Power
- 0
byte to string conversion creates problem in streams
I am reading bytes from InputStream and converting these bytes read to the string .After that I am writing bytes to the Output Stream.
Following is the code-
Java Code:byte[] b = new byte [16384]; int len = inputStream.read(b); String s = new String( b ); outputStream.write(s.getBytes(), 0 , len);
May I know if I am doing any mistake in these string to byte conversion?
- 12-05-2012, 11:11 PM #2
Member
- Join Date
- Dec 2011
- Posts
- 25
- Rep Power
- 0
Re: byte to string conversion creates problem in streams
When you say
Java Code:String s = new String(b);
Java Code:String s = new String(b, 0, len);
Similar Threads
-
String to byte conversion
By YellowSun in forum New To JavaReplies: 1Last Post: 02-02-2012, 09:19 PM -
Byte[] to string and string to byte[] - for database
By kronox in forum New To JavaReplies: 2Last Post: 11-21-2011, 01:08 AM -
Byte vs. Character Streams
By Lil_Aziz1 in forum New To JavaReplies: 5Last Post: 08-06-2010, 04:16 PM -
image to byte code file conversion
By nupurashi in forum New To JavaReplies: 0Last Post: 01-28-2009, 11:25 AM
Bookmarks