Hi,
I am having problems reading from an InputStream into a StringBuffer.
For some reason the content of the StringBuffer gets truncated.
Any ideas how to solve this?
Thanks!
...
final int BLOCKSIZE = 1024
InputStream input
OutputStream output
StringBuffer content = new StringBuffer()...
byte[] block = new byte[BLOCKSIZE]
boolean done = false
while(!done) {
try {
int size = input.read(block)
println "size: "+size
if(size >0) {
content.append(new String(block)) }
if(size == -1) {
done = true
}
} catch (IOException e) {
System.err.println(e.getMessage())
done = true
}
}
...
Hotmail: Free, trusted and rich email service.
Get it now.