java - Ask a question about IO
我想大声告诉你
我想大声告诉你 2017-05-17 10:06:43
0
1
579
OutputStream outputStream = uploadFileUtil.getTargetFileOutputStream(monthlyReportFolder, fileName);

I use a method to return the stream object of the SmbFile object based on the Http file path, that is, I obtain the OutputStream. It is known that this file is an html file. Now I want to read this file into a String object, that is, I want to get the source code in this html file.
Please tell me how to operate,

我想大声告诉你
我想大声告诉你

reply all(1)
習慣沉默

What is the specific instance type pointed to by this outputStream?
Assuming it points to a FileOutputStream, you can use code similar to the following to obtain its source code.

OutputStream outputStream = new FileOutputStream(fileName);
ByteArrayOutputStream baos=new ByteArrayOutputStream();  
outputStream.write(baos.toByteArray());  
str = baos.toString(); 
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!