I want to ask a question about Java. I have use the URLConnection in Java to retrieve the DataInputStream. and I want to convert the DataInputStream into a String variable i
You can use commons-io IOUtils.toString(dataConnection.getInputStream(), encoding) in order to achieve your goal.
IOUtils.toString(dataConnection.getInputStream(), encoding)
DataInputStream is not used for what you want - i.e. you want to read the content of a website as String.
DataInputStream
String