?? atest.java
字號:
import java.io.*;
import java.lang.*;
import java.util.*;
class Iterms
{
public Iterms()
{
num=0;
}
public String []str=new String[4];
int num;
public void set(String str1)
{
this.num ++;
str[num-1]=str1;
}
}
public class Atest {
//FileInputStreamDemo
public static void main(String[]args)throws Exception
{
Iterms []iterms=new Iterms[2000];
FileReader fr = new FileReader("E:\\javatest\\FreItemSet_25");
BufferedReader br = new BufferedReader(fr);
String line = br.readLine();
CharArrayWriter f = new CharArrayWriter();
boolean boon=false;
boolean boon1=false;
List list=new ArrayList();
List list1=new ArrayList();
int r=0;
while(line!= null)
{
char buf[] = new char[line.length()];
line.getChars(0, line.length(), buf, 0);
f.write(buf);
//System.out.println("Buffer as a string");
//System.out.println(f.toString());
//System.out.println("Into array");
char c[] = f.toCharArray();
//String str[]=new String[3];
int n=0;
int m=0;
StringBuilder strb=new StringBuilder();
iterms[r]=new Iterms();
for (int j=0;j<c.length;j++)
{
if(c[j]==' '||c[j]==')')
{
boon=false;
iterms[r].str[m]=strb.toString();
}
if(c[j]=='I'||boon==true)
{
boon=true;
if(c[j]==',')
{
iterms[r].str[m]=strb.toString();
//System.out.print(iterms[r].str[m]+" ");
strb.delete(0,n);
m++;
n=0;
}
else
{
n++;
strb.append(c[j]);
}
/*if(c[j]==',')
{
str[n]=new String(ch);
n++;
m=0;
}
else
{
//list.add((char)c[j]);
// boon1=true;
// m++;
}*/
}
/*if(boon1==true)
{
for(int l=0;l<list.size();l++)
{
if((char)(list.get(l))!=",")list1.add((char)(list.get(l)));
else
{
str[n]=new String((list1.toArray()));
n++;
list1.clear();
}
}
}
else
{
str[0]=new String(list.toArray());
}
boon1=false;
*/
}
//for(int k=0;k<str.length;k++)
//{
//System.out.print(str[k]+' ');
//}
System.out.println();
f.reset();
//System.out.print((char)ch);
line =br.readLine();
r++;
//}
}
br.close();
fr.close();
for(int k=0;k<10;k++)
{
for(int t=0;t<3;t++)
System.out.print(iterms[k].str[t]+" ");
System.out.println();
}
/*int size;
InputStream f=new FileInputStream("E:\\javatest\\FreItemSet_25");
System.out.println("Total Available bytes: "+(size=f.available()));
int n=size/40;
System.out.println("First "+n+" bytes of the file one read() at a time");
String []ch=new String[2000];
for(int i=0;i<n;i++)
{
ch[i]=(String)f.read();
//System.out.print((char)f.read());
}
for(int i=0;i<20;i++)
{
System.out.println(i+"'s string is "+ch[i]);
}
System.out.println("\nStill Available: "+f.available());
System.out.println("Reading the next "+n+" with one read(b[])");
byte b[]=new byte[n];
if(f.read(b)!=n)
{
System.out.println("couldn't read "+n+" bytes.");
}
System.out.println(new String(b,0,n));
System.out.println("\nStill Available:"+f.available());
System.out.println("Reading "+n/2+" into the end of array");
if(f.read(b,n/2,n/2)!=n/2)
{
System.err.println("couldn't read "+n/2+" bytes.");
}
System.out.println(new String(b,0,b.length));
System.out.println("\nStill Available: "+f.available());
f.close();*/
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -