Java的IO实例
//Java的IO的一个实例
import java.io.*;
import java.util.zip.*;
public class abc5{
String temp=new String();
String t=new String();
public void readByLinefromConsoleAndPrint(){
System.out.println("==从控制台获得输入==");
try{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.println("请输入一行字符:");
System.out.println(temp=in.readLine());
}
catch(IOException e){
e.printStackTrace();
}
}
public void readByLinefromFileAndPrint(){
System.out.println("==从文件获得输入==");
try{
BufferedReader in=new BufferedReader(new FileReader("abc.dat"));
temp="";
String s=new String();
while((s=in.readLine())!=null)
temp+=s+"\n";
in.close();
System.out.println(temp);
}
catch(FileNotFoundException e){
e.printStackTrace();
}
catch(IOException e){
e.printStackTrace();
}
}
public void readfromMemoryAndPrint(){
System.out.println("==从内存获得输入==");
try{
StringReader stringReader=new StringReader(temp);
int t;
while((t=stringReader.read())!=-1)
System.out.println((char)t);
}
catch(IOException e){
e.printStackTrace();
}
}
public void writeToFile()
{
System.out.println("==文件输出流==");
try{
BufferedReader in=new BufferedReader(new StringReader(temp));
PrintWriter out=new PrintWriter(new BufferedWriter(new FileWriter("abc.dat")));
while((t=in.readLine())!=null)
o
相关文档:
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--每页显示记录条数
@currentpage int output,--第几页
@orderid nvarchar(50),--主键排序
@sort int,--排序方式,1表示升序,0表示降序排列
......
一:准备 www.savarese.org download
1. rocksaw-1.0.0-src.tar.gz
2. vserv-tcpip-0.9.2-src.tar.gz
二:编译源文件得到jar包 使用Ant
1. build vserv-tcpip-0.9.2-src
在vserv-tcpip-0.9.2目录下面建一个tests目录,然后在cmd窗口下进入 ......
类的初始化和对象初始化是 JVM 管理的类型生命周期中非常重要的两个环节,Google 了一遍网络,有关类装载机制的文章倒是不少,然而类初始化和对象初始化的文章并不多,特别是从字节码和 JVM 层次来分析的文章更是鲜有所见。
本文主要对类和对象初始化全过程进行分析,通过一个实际问题引入,将源代码转换成 JVM 字节码后, ......
主要是利用Java提供的util包中的Properties类。废话不多说,直接看代码:
view plaincopy to clipboardprint?
import java.util.*;
public class YourJavaProperties {
public static void main(String args[]){
Properties props=System.getProperties();
System.out.println("Java的运行环境版本:"+props.getP ......
一个Java字体设置程序,包括大小,颜色,加粗,下划线,对齐,斜体的设置,很全!!! 收藏
Swing对JTextPane中字体颜色的设置
转自:http://www.blogjava.net/Swing/archive/2007/12/26/128965.html
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.a ......