81,092
社区成员
发帖
与我相关
我的任务
分享
int length=0;
byte[] buf = new byte[1024];
while ((length = is.read(buf)) >= 0) {
System.out.println(new String(buf));
}
public static void main(String[] args) {
//
try {
readFile("D:\\work\\test\\src\\log4j.properties");
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
public static void readFile(String fileName) throws Exception{
File file = new File(fileName);
BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
int length=0;
byte[] buf = new byte[1024];
while ((length = in.read(buf)) != -1) {
System.out.println(new String(buf,0,length));
}
}
length = is.read(buf))
InputStream is = get.getResponseBodyAsStream();
byte[] buf = new byte[1024];
while ((length = is.read(buf)) >= 0) {
....
}