decode inputstream??

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

decode inputstream??

Postby guruk » Fri Mar 13, 2009 2:41 pm

Hi,

I have two versions to read my data, but anyhow.. how to decode the data (windows-1252)
in the right way.. right now i dont see for example the german umlaute

-----------------------
conn = new URL(mediaUrl).openConnection();
InputStream is = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
ByteArrayBuffer baf = new ByteArrayBuffer(50);


/*-- much faster */
int size = is.available();
byte[] buffer = new byte[size];
is.read(buffer);
is.close();
html = new String(buffer);


/* slower version
int current = 0;
while ((current = isr.read()) != -1)
{
baf.append((byte) current);
}

html = new String(baf.toByteArray());
*/
-----------------------------------------

hope one of you know a solution

thanks
chris
guruk
Junior Developer
Junior Developer
 
Posts: 24
Joined: Sun Mar 08, 2009 8:05 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 4 guests