Java 操作文本 封装类
package com.sidi.card.util;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* 用于对文本的操作
*
* @author 朱志杰
*
*/
public class NoteOperate {
// txt文件路径
private String filePath;
/**
* 构造函数
*
* @param filePath
* 文本文件全路径
*/
public NoteOperate(String filePath) {
this.filePath = filePath;
}
/**
* 构造函数
*
* @param file
* 需要读取的文本文件
*/
public NoteOperate(File file) {
this.filePath = file.getPath();
}
/**
* 判断文本文件是否存在
*
* @return 存在返回true 否则返回false
*/
public boolean exists() {
File file = new File(this.filePath);
return file.exists();
}
/**
* 得到这个txt所有的列的数据 空行将自动跳过,并自动删除文字前后的空格
*
* @return List<String>
* @throws IOException
*/
public List<String&g
相关文档:
java Map 遍历速度最优解
第一种:
Map map = new HashMap();
Iterator iter = map.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
Object key = entry.getKey();
Object val = entry.getValue();
}
效率高,以后一定要使用此种方式!
第二种:
Map map = ......
ParserAdapter,MouseInputAdapter....
interface can be added to an existing class or used to create an adapter
方法就是 面向结构语言的:函数
java中适配器的作用实际上是实现了接口的类,但是适配器所实现的只是空方法。因为如果我们不用适配器,直接去实现接口,也要逐个实现里面的方法,并且大多情况下我们 ......
2010-03-18
package javaEcsl;
import java.io.*;
import java.util.*;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
/** */
/**
* <p>
* Title:
* </p>
* <div>Description: Excel数据导入到oracle数据库类. </div>
* <p>
* Copyright: Copyright (c) 200 ......
对于Java的语言机制而言,当一个方法被声明为了static或者final类型的时候,该方法可以被拥有该方法的类的子类继承,但是不能被覆盖,这是因为当一个方法被声明为了上述两种类型的时候,在编译时刻该方法的调用着的类型已经被确定,是静态绑定,而不是动态绑定。同时在声明为static方法体里是不允许使用this和super关键字的 ......
编译eclair碰到java version "1.5.0_18"问题的解决
make提示:
Your version is: java version "1.5.0_18"
修改
build\core\main.mk
# Check for the correct version of java
java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1\.6[\. "$$]')
改成:
java_version := $(shell java -ve ......