InputStream转String
public static String inputStreamToString(InputStream is) {
byte[] bytes = new byte[1024 * 4];
try {
is.read(bytes);
} catch (IOException e) {
log.error(e);
}
return new String(bytes);
}
String转InputStream
InputStream is = new ByteArrayInputStream(str.getBytes());