比如说我要读取一个文件中的一个双字大小的变量的值,那我该如何做啊?谢谢。

解决方案 »

  1.   

    FileInputStream.read(byte[] b)
    FileInputStream.read(byte[] b, int off, int len)
      

  2.   

    to puretls(): 但是这个市字节数组阿,每一个单位只有一个字节阿
      

  3.   

    字节数组可以自定义长度啊!byte[] b = new byte[长度];
    FileInputStream.read( b);
      

  4.   

    public int read(char[] cbuf,
                    int offset,
                    int length)
      

  5.   

    FileInputStream.read(byte[] b, int off, int len)
    只有这个方法了,不然就自己封装一下
      

  6.   

    public int read(byte[] b,
                    int off,
                    int len)
             throws IOException
    Reads up to len bytes of data from this input stream into an array of bytes. This method blocks until some input is available.
      

  7.   

    1.FileInputStream    read(byte[] b)
      

  8.   

    2:DataInputStream :readLong() 
      

  9.   

    RandomAccessFile raf = new  RandomAccessFile(file,mode);
    byte[] b = new byte();
    raf,read(b);
    这样就能读了,如果你还想指定位置
    raf。seek(addr);