用java写的读磁盘扇区代码

来源:百度文库 编辑:神马文学网 时间:2024/04/30 02:33:35
用java写的读磁盘扇区代码

public boolean readSector(String diskSign, byte[]buf, int length)
    {
     try{
      FileInputStream fr = new FileInputStream(diskSign);
      BufferedInputStream br = new BufferedInputStream(fr);
      
      br.read(buf, 0, length);
      br.close();
      fr.close();
     }catch(IOException e)
     {
      System.out.println(e.getMessage());
      return false;
     }
     return true;
    }
String diskSign = "[url=]\\\\.\\e[/url]:";