package edu.janely.cn;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class test {
// 1. String --> InputStream
InputStream StringToInputStream(String str) {
ByteArrayInputStream stream = new ByteArrayInputStream(str.getBytes());
return stream;
}
// 2. InputStream --> String
String inputStreamToString(InputStream is) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(is));
StringBuffer buffer = new StringBuffer();
String line = "";
while ((line = in.readLine()) != null) {
buffer.append(line);
}
return buffer.toString();
}
// char --> String
public static void main(String[] args) {
char cha = 'd';
String str = new Character(cha).toString();
System.out.println(str);
}
//..续
}