读log文件及与时间对比
来源:互联网 发布:r语言怎么保存数据 编辑:程序博客网 时间:2024/06/05 03:34
public String getlog() throws IOException, ParseException{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long now_time = System.currentTimeMillis();
long before_one_hour_time = now_time - 3600000;
FileInputStream fis = new FileInputStream("E:/log/data.log.2010-05-26");
Iterator<String> itr = IOUtils.lineIterator(fis, "utf-8");
while (itr.hasNext())
{
String line = itr.next();
String lineTime = line.substring(0, 19);
String str=line.substring(20);
long time = format.parse(lineTime).getTime();
if (time >= before_one_hour_time && time <= now_time)
{
String str1=line.substring(20);
return str1;
}
else
{
return null;
}
}
return null;
}
- 读log文件及与时间对比
- console.log()与alert()对比使用及console.log()使用注意事项
- 创建log文件夹及文件
- 输入时间与当前时间对比
- 自定义Magento Log文件的时间格式 - Magento Log Timestamp
- Cordys Web Gateway与XForm的监控及log文件下载(SecureCRT)
- JS与PHP日期时间对比
- 快速排序与归并排序时间对比
- LOG日志时间与show clock时间…
- 批处理删除log文件夹及文件
- Android中的信息输出:System.out和Log的源码分析与对比(Log篇)
- Linux下创建与解压tar, tar.gz和tar.bz2文件及压缩率对比
- Linux下创建与解压tar, tar.gz和tar.bz2文件及压缩率对比
- Linux下创建与解压tar, tar.gz和tar.bz2文件及压缩率对比
- Linux下创建与解压tar, tar.gz和tar.bz2文件及压缩率对比
- 文件时间与系统时间
- 文件时间与系统时间
- oracle日期时间与java日期时间对比
- Ignorance bless you! 无知是福
- 查找两个word文件的不同
- 如何往自己编译的opencore里面添加自己的项目。
- ubuntu 下使用ie浏览器
- 各种系统架构图及其简介
- 读log文件及与时间对比
- C++内存管理
- linux 定时任务 crond
- JAVA 编译找不到符号
- 最近要看的书
- 谷歌预计Google Apps营收达10亿美元
- How to know windows last boot time? -如何知道Windows系统上次启动时间?
- 4KB大扇区硬盘的性能分析
- 抽象派诗歌