read(bytes)
来源:互联网 发布:mac 查看文件夹权限 编辑:程序博客网 时间:2024/06/04 20:04
ServletContext context = event.getServletContext();
String filePath = context.getRealPath("/ch04/count.txt");
FileInputStream fis = null ;
BufferedInputStream bis = null ;
DataInputStream dis = null ;
StringBuffer sb = new StringBuffer() ;
byte[] bytes = new byte[1024];
try {
int c = 0 ;
fis = new FileInputStream(filePath) ;
dis = new DataInputStream(fis);
// while((c=dis.read())!=-1)
// {
// sb.append((char)c);
// System.out.println((char)c+"*");
// }
while((c=dis.read(bytes))!=-1)
{
String str = new String(bytes,0,c);
sb.append(str);
}
fis.close();
dis.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("初始化listener");
System.out.println(filePath) ;
System.out.println(sb.toString()+"------------------");
String filePath = context.getRealPath("/ch04/count.txt");
FileInputStream fis = null ;
BufferedInputStream bis = null ;
DataInputStream dis = null ;
StringBuffer sb = new StringBuffer() ;
byte[] bytes = new byte[1024];
try {
int c = 0 ;
fis = new FileInputStream(filePath) ;
dis = new DataInputStream(fis);
// while((c=dis.read())!=-1)
// {
// sb.append((char)c);
// System.out.println((char)c+"*");
// }
while((c=dis.read(bytes))!=-1)
{
String str = new String(bytes,0,c);
sb.append(str);
}
fis.close();
dis.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("初始化listener");
System.out.println(filePath) ;
System.out.println(sb.toString()+"------------------");
- read(bytes)
- HDFS bytes read与Map input bytes
- Unable to read entire header; bytes read; expected bytes
- Read and write bytes data
- Can not read response from server. Expected to read 4 bytes, read 0 bytes
- read GBK code from bytes,string operations
- java.io.IOException: Unable to read entire header; 0 bytes read; expected 32 bytes
- Unable to read entire header; 336 bytes read; expected 512 bytes
- Reading given number of bytes with RSocket::Read()
- java.io.EOFException: while trying to read 65557 bytes
- ORA-27063: number of bytes read/written is incorrect
- python使用thrift出现TTransportException: TSocket read 0 bytes
- Fatal error: Unable to read 1403 bytes in 报错
- thrift TSocket read 0 bytes(string类型中的一个坑)
- Error: Read from storage 0 bytes, but requested 12 bytes 的解决方法
- bytes
- mysql Can not read response from server. Expected to read 4 bytes 异常
- web服务连接mysql报错 解析:Can not read response from server. Expected to read 4 bytes, read 0 bytes before c
- jQuery表单Input文本框默认说明文字获得焦点后消失效果
- 敏捷个人
- Search Help技术
- 为什么重构有用
- 互联网成人类记忆硬盘
- read(bytes)
- Windows Resource Kit 工具下载
- H264编码方式解析(1)
- hibernate 映射文件配置默认值方法
- Utilities之EXP&IMP小结-续3-总结
- 找文本表的小技巧
- form 中Enctype=multipart/form-data 的作用
- 组织结构树形结构
- Debug Assertion Failed!