import java.io.RandomAccessFile;
public class IOQuestion
{
public static void main(String[] args) throws Exception
{
int a=0;
RandomAccessFile rdf = new RandomAccessFile("abc.txt","rw");
rdf.write("daizhenliang".getBytes());
RandomAccessFile rdf1 = new RandomAccessFile("abc.txt","rw");
byte [] buf = new byte[12];
int len = rdf1.read(buf);
// System.out.println(len);
// System.out.println(buf);
System.out.println(new String(buf,0,buf.length-1));
}
}
像是不能是同一对象 |