📄 harddiskdriver.java
字号:
/* * HardDiskDriver.java * * Created on 2006年3月15日, 下午9:58 * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package os.memory.harddisk;/** * * @author Vernkin */import java.io.*;public class HardDiskDriver { String head = "src/source/"; public static HardDiskDriver hd = new HardDiskDriver(); /** Creates only a new instance of HardDiskDriver */ private HardDiskDriver() { } public static HardDiskDriver getInstance(){ return hd; } public int[] getData(String name){ // String sour = head+name+".txt"; // System.out.println("HDisk Open "+sour); BufferedReader br =null,br2 = null; int[] ret = null; int count=0; String temp; try{ br = new BufferedReader(new FileReader(name)); temp = br.readLine(); while(temp!=null && !temp.equals("")){ count++; temp = br.readLine(); // System.out.println(temp); } br.close(); if(count == 0) return null; ret = new int[count]; count = 0; br2 = new BufferedReader(new FileReader(name)); temp = br2.readLine(); while(temp!=null && !temp.equals("")){ ret[count++] = Integer.parseInt("0"+temp, 2); // System.out.println(ret[count-1]); temp = br2.readLine(); } }catch(IOException e){ System.out.println(e.getMessage()); return ret; } return ret; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -