操作方法
打开myeclipse,在窗口中进入属性编辑界面
进入模板代码添加的界面,并点击new按钮
弹出对话框
比如是添加rw的读写操作代码块 那么name的地方设置名字,pattern的地方添加模板代码
这里提供读写操作的模板代码: 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(); } } } 这个代码可以作为参考
在编译的时候只有写出rw之后使用alt+/就可以将模板代码全部展现出来