- import java.io.BufferedWriter;
- import java.io.File;
- import java.io.FileOutputStream;
-
- randomFile.seek(fileLength);
- randomFile.writeBytes(content);
- } catch (IOException e) {
- e.printStackTrace();
- } finally{
- if(randomFile != null){
- try {
- randomFile.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
-
- public static void main(String[] args) {
- try{
- File file = new File("d://text.txt");
- if(file.createNewFile()){
- System.out.println("Create file successed");
- }
- method1("d://text.txt", "123");
- method2("d://text.txt", "123");
- method3("d://text.txt", "123");
- }catch(Exception e){
- System.out.println(e);
- }
- }
- }
posted on
2017-02-14 10:44
sdfczyx
阅读(
169)
评论()
收藏
举报