큰 지혜

2365 단어 F#
또 하나 존재하는 것은 txt에 출력된 데이터가 한데 연결되어 뚜렷한 지점이 없다는 것이다. 지금은 미화하고 데이터베이스를 사용하고 있다.

/**
 *         ,   Level-2     (.dat)     (.txt)    
         * */
private static ArrayList<Vector<Comparable>> list; 
public static void main(String[] args) throws Exception { 
DataInputStream in = null; 
File f = new File("F:/gupiao.txt");

//     

list = new ArrayList<Vector<Comparable>>(); 
FileOutputStream fos = new FileOutputStream(f);
PrintWriter pw = new PrintWriter(fos,true);
try { 
in = new DataInputStream(new BufferedInputStream( 
new FileInputStream(new File("E:/  /dzh2/data/sz/day.dat")))); 
} catch (FileNotFoundException fileNotFoundException) { 
fileNotFoundException.printStackTrace(); 

} 
try { 

in.skipBytes(266240);//         
Vector vt = new Vector(); 
DateFormat riqi = new SimpleDateFormat("yyyy-MM-dd"); 
 
for (int i = 0; i < 8;  i++) { 

byte[] bt = new byte[4]; 

in.read(bt); 
//          

if (i == 0) { 

String dateFormat = riqi 
.format(new Date( 
1000 * (long) ((bt[3] & 0xff) << 24 
| (bt[2] & 0xff) << 16 
| (bt[1] & 0xff) << 8 | (bt[0] & 0xff)))).toString(); 

vt.add(dateFormat); 
//out.StringWriter(dateFormat,0,dateFormat.length()); 

System.out.println("  : " + dateFormat); 
pw.write(dateFormat);
pw.flush();  


} 
else{ 

Float dateFloat = new Float(Float 
.intBitsToFloat((bt[3] & 0xff) << 24 
| (bt[2] & 0xff) << 16 
| (bt[1] & 0xff) << 8 | (bt[0] & 0xff))); 

vt.add(dateFloat); 
System.out.println(dateFloat); 
pw.print(dateFloat  );

pw.flush();
//out.writer(dateFloat,0,dateFloat.length()); 
} 


            in.skipBytes(4); 

} 

list.add(vt); 

} catch (IOException e) { 

// TODO Auto-generated catch block 

e.printStackTrace(); 

} finally { 
if (in != null) 
in.close(); 
if (pw != null) { 
pw.close(); 
} 

} 

} 

좋은 웹페이지 즐겨찾기