private String readLine (InputStream is){
StringBuffer data = new StringBuffer("");
int c;
try {
is.mark(1);
if (is.read() == -1)
return null;
else
is.reset();
while ((c = is.read()) >= 0){
if ((c == 0) || (c == 10) || (c == 13))
break;
else
data.append((char)c);
}
if (c == 13){
is.mark(1);
if (is.read() != 10)
is.reset();
}
} catch (Exception e) {
System.out.println("Errore nella decodifica dell'header: " + e);
}
return data.toString();
}