public class Test02 {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
//使用类加载加载classpath下的文件
ClassLoader ld=Test02.class.getClassLoader();
InputStream in =ld.getResourceAsStream("it/heima/com/prop.ini");
byte[] by=new byte[1024];
int i=0;
while((i=in.read(by))!=-1){
System.out.println(new String(by, 0, by.length));
}
}
|
|