请问我应该如何写这段代码,调用这个add_gw_menu(String,String)方法后,把它读进数据库.
|
Connection c=null; PreparedStatement pstmt = null ; } |
2. 读取文件内容
|
import java.io.*; /** public static void main(String[] args) { |
3. 指定文件内容的替换,输出到新文件
| import java.io.*; /** * 指定文件内容的替换,输出到新文件 * @author 张斌(小神) * */ public class ReplaceString_File { /** * * @param pathName : 读取文件路径 * @param newPathName : 输出文件路径 * @param course : 要修改的字串 * @param value : 新字串 * @throws IOException */ public void replaceString(String pathName, String newPathName, String course, String value) throws IOException { File file = new File(pathName); File file_output = new File(newPathName); if (file.exists()) { BufferedReader br = new BufferedReader(new FileReader(file)); BufferedWriter bw = new BufferedWriter(new FileWriter(newPathName)); String context; while ((context = br.readLine()) != null) { context.replace(course, value); bw.write(context); bw.newLine(); //System.out.println(context); } bw.flush(); br.close(); bw.close(); } } public static void main(String[] args) { ReplaceString_File rsf = new ReplaceString_File(); try { rsf.replaceString("F://321.txt", "F://123.txt", "def=456", "def=654"); } catch (IOException e) { e.printStackTrace(); } } } |

被折叠的 条评论
为什么被折叠?



