randomaccessfile
(file file, string mode)
;
建立從中讀取和向其中寫入的隨機訪問檔案流,該檔案由file引數指定
randomaccessfile
(string name, string mode)
;
建立從中讀取和向其中寫入的隨機訪問檔案流,該檔案具有指定的名稱
其中:mode:4種模式
「r」: 以唯讀的方式開啟 呼叫write方法會丟擲ioexception
2)「rw」: 便於讀取和寫入
3)「rws」: 便於讀取和寫入,同時對檔案的內容和元資料的更新都會同步儲存到基礎儲存裝置
4)「rwd」: 便於讀取和寫入,同時對檔案的內容的更新都會同步儲存到基礎儲存裝置
public
void
seek
(long pos)
設定檔案指標的位置
public
native
long
getfilepointer
()
返回檔案指標的位置
public
intread()
;
從此檔案中讀取乙個資料位元組(8bit)
public
intwrite
(int b)
;
向此檔案中寫入乙個資料位元組(8bit)
public
static
void
main
(string[
] args)
}catch
(filenotfoundexception e)
catch
(ioexception e)
finally
catch
(ioexception e)}}
}
public
static
void
main
(string[
] args)
fis =
newfileinputstream
(file)
; fos =
newfileoutputstream
(file)
;byte
bytes =
newbyte
[256];
int len;
while
((len = raf.
read
(bytes)
)>0)
raf.
seek
(256);
string ss =
"圖論有限科技公司"
; raf.
write
(ss.
getbytes()
);while
((len = fis.
read
(bytes))!=
-1) fis.
close()
; fos.
close()
;if(file.
exists()
)}catch
(filenotfoundexception e)
catch
(ioexception e)
finally
catch
(ioexception e)
}}
UITableViewCell的使用和屬性
uitableview的每一行都是乙個uitableviewcell,通過datasource的tableview cellforrowatindexpath 方法來初始化每一行。uitableviewcell內部有個預設的子檢視 contentview,contentview是uitablevie...
display和visibility的屬性
display屬性設定元素的顯示方式,對應指令碼特性為display,可選值為none block和inline,各值的說明如下 none 隱藏元素,不保留元素顯示時的空間。block塊方式顯示元素。inline 以內嵌方式顯示元素。visibility屬性設定是否顯示元素,對應的指令碼特性為vis...
chrome vs IE 謹慎使用float屬性
在頁面布局這塊,目前流行的做法是div css。用div把頁面分成幾塊,然後用css來控制這幾塊在頁面上的排列,從而達到我們的塊狀布局。我這裡並不準備做乙個正式的網頁,只是想說一下自己在布局時遇到的一些趣事。1.準備乙個簡單的html頁面 這個頁面只有幾個div,沒有任何的文字內容。如下 當然這只是...