抄自QuickServer的源码
private static byte[] toBytes(InputStream _in) throws IOException {
byte[] data = null;
int s = _in.read();
if (s == -1) {
return null;
}
int alength = _in.available();
if (alength > 0) {
data = new byte[alength + 1];
_in.read(data, 1, alength);
} else {
data = new byte[1];
}
data[0] = (byte) s;
return data;
}