在便以其中添加一些相同的代碼,可以通過(guò)代碼的方式存儲(chǔ)起來(lái),之后加載的時(shí)候只需要通過(guò)快捷方式加載就可以了,很方便快捷。
1、打開(kāi)myeclipse,在窗口中進(jìn)入屬性編輯界面
2、進(jìn)入模板代碼添加的界面,并點(diǎn)擊new按鈕
3、彈出對(duì)話框
4、比如是添加rw的讀寫操作代碼塊,那么name的地方設(shè)置名字,pattern的地方添加模板代碼
5、這里提供讀寫操作的模板代碼:
InputStream in = null;
OutputStream out = null;
try{
in = new FileInputStream(path);
int len = 0;
byte[] buffer = new byte[1024];
out = new FileOutputStream("");
while((len = in.read(buffer)) > 0){
out.write(buffer, 0, len);
}
}
finally{
if(in != null){
try{
in.close();
}catch(Exception e){
e.printStackTrace();
}
}
if(out != null){
try{
out.close();
}catch(Exception e){
e.printStackTrace();
}
}
}
這個(gè)代碼可以作為參考
6、在編譯的時(shí)候只有寫出rw之后使用alt+/就可以將模板代碼全部展現(xiàn)出來(lái)
相關(guān)推薦:
myeclipse2014怎么打開(kāi)web開(kāi)發(fā)項(xiàng)目?
MyEclipse中Servers窗口在哪里怎么顯示?
MyEclipse2015打開(kāi)提示Tern Sercer Tineout錯(cuò)誤怎么辦?
新聞熱點(diǎn)
疑難解答
圖片精選