易截截图软件、单文件、免安装、纯绿色、仅160KB

java学习笔记

最近学习java的IO操作,现整理如下
1   输入输出
  java的库将程序与输入有关的类都从InputStream继承,与输出有关的类都从OutStream继承。
以前没有掌握的相关类  SequenceInputStream 将两个或更多的inputStream 转换成单个对象使用。
2 增添属性和有用的接口
装饰器 : 利用层次化对象动态透明的增加单个对象的能力的做法叫做“装饰器” 
3 输入
对一个文件进行输入操作,需要一个FileInputStream 对象,为提高速度需要对文件进行缓冲处理 BufferedInputStream  ,为了以格式化的形式读取数据,我们使用了DataInputStream 来进行处理。 
DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(args[0]))); 
4 快速文件输入
class InFile extends DataInputStream {

public InFile(String fileName) throws FileNotFoundException{
super(new BufferedInputStream(new FileInputStream(fileName)));
}

public InFile(File file) throws FileNotFoundException{
super(new BufferedInputStream(new FileInputStream(file.getPath())));
}
}
这样设计可以避免每次重复够造 。
同样快速文件输出可以按照上述的格式进行构造。
5 Reader Writer 
inputstream 是字节流 ,二reader是字符流 传递unicode 。
要使用readLine()应该使用BufferedReader ,二不应该再使用DataInputStream 
6 重导向标准IO package cn.bupt.io;
import java.io.*;
public class Redirect {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
BufferedInputStream in = null ;
try {
in = new BufferedInputStream(new FileInputStream(args[0]));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
PrintStream out = null ;

try {
out = new PrintStream(new BufferedOutputStream(new FileOutputStream(args[1]))) ;
} catch (FileNotFoundException e) {
e.printStackTrace();
}


System.setIn(in) ;
System.setOut(out) ;
System.setErr(out) ;


BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = null ;
try {
whil


相关文档:

CICS JAVA SAMPLE

首先是build sample
遇到的第一个错误
ADCDMST:/Z19/usr/lpp/cicsts/cicsts32/samples/dfjcics: >make -f makefile jvm   
make: Error -- FSUM9383 Configuration file `/etc/startup.mk' not found  
修复:cp /samples/startup.mk /etc/startup.mk
export JAVA_HOME=/Z19/usr/lpp/jav ......

Java包装类学习

我们应用某种数据类型时,很多时候要进行类型转换等操作。在Delphi中,类型转换函数感觉很零乱,如字符串转整形、整形变字节数组等等。
而在JAVA中,已经将Java的基本数据类型与其提供了一些常用的类型操作的方法进行了封装,这样才有一切皆对象的感觉。
在学习包装类时,找了几个比较有意思的类进行了学习!
Integer
I ......

java IO流 分析


一、
IO
流的三种分类方式
    1.
按流的方向分为:输入流和输出流
    2.
按流的数据单位不同分为:字节流和字符流
    3.
按流的功能不同分为:节点流和处理流
   
二、
IO
流的四大抽象类:
   
字符流:
Reader Writer ......

JAVA基础篇(一)

      本篇内容系统JAVA基础知识介绍,适用于初学者和复习的朋友阅读。作为本人,虽尽量查阅各种书籍,但是仍难避免各种错误和不当,还请看过并发现其中错误的朋友指正。
    一.简介
          1.Green Team小组与JAVA
&nb ......

java 操作注册表

import java.util.prefs.*;  
public class Registery {  
    String[] keys = {"oa"};  
    String[] values = {"reg"};  
 //把相应的值储存到变量中去  
    public void writeValue() {   ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号