我正在尝试替换此文件中文本的第 3 行,但无法更新正确的行:
ENTITY test_labelOperation IS
generic (
NO_OF_COLS : integer := 640;// This is 3rd line and replace should be look like NO_OF_RECTGlE=100;
NO_OF_ROWS : integer := 480;
NO_BITS_CC : integer := 10;
DATA_WORD : integer :=8;
CODE_WIDTH :integer :=9
);
END test_labelOperation;
这是我正在尝试的代码:
RandomAccessFile raf=new RandomAccessFile(absoluteFile,"rw");
int lineCount=0;
while(raf.read()!=-1) {
String s=raf.readLine();
//System.out.println(s);
String stAry[];
lineCount++;
if (lineCount==3) {
System.out.println(s);
stAry=s.split("=",2);
stAry[0]="NO_OF_RECTGlE";
stary[1]=100+";";
String str=Arrays.toString(stAry);
byte []byt=str.getBytes();
raf.write(byt);
}
}