2014-07-04 10 views
0

Nexus 5에서 시스템 파일을 읽으려는 중 일부 수정을 통해 두 번째 파일로 다시 쓰려고합니다. 문제는 내 수정 없이도 파일이 완전히 쓰여지지 않는다는 것입니다. Il은 거의 끝까지 도착한 다음 항상 같은 장소에서 글쓰기를 멈 춥니 다. 450 라인에서 멈추고 <path name="voice-tty-full-headphones">을 써야하고 더 많은 라인을 계속 쓰려면 ...파일을 완전히 쓰지 못했습니다.

이상하게도 textview로 내보내기하면 모든 것이 거기에 있으므로 파일을 읽을 때 문제가 발생하지 않습니다. 새로운. 내가 작업중인 파일의 사본을 생성 된 파일의 사본과 함께 첨부했습니다. 나는 정말로 여기에서 무엇을 시험해 볼 것인지 전혀 모른다.

//Output File 
File outputFile = new File(Environment.getExternalStorageDirectory().getPath(), "/xxx/mixer_paths.xml"); 
outputFile.createNewFile(); 
FileOutputStream fOut = new FileOutputStream(outputFile); 
OutputStreamWriter myOutWriter =new OutputStreamWriter(fOut); 

//Input File 
File internalStorage = Environment.getRootDirectory(); 
File inputFile = new File(internalStorage,"/etc/mixer_paths.xml"); 
BufferedReader br = new BufferedReader(new FileReader(inputFile)); 

StringBuilder text = new StringBuilder(); 
String line; 


while ((line = br.readLine()) != null) 
{ 
    text.append(line+"\n"); 
} 

    myOutWriter.append(text); 
    textView.setText(text); 

https://www.dropbox.com/s/7p1cgu7ziyzydh1/mixer_paths_original.xml https://www.dropbox.com/s/zs03xt4k52vetek/mixer_paths_new.xml

감사

답변

2

당신이 작가를 닫습니다 잊어 버리셨습니까? 나는이 실수를 저질 렀다. 독자와 작성자가 작업을 끝내면 항상 닫습니다. 자원을 확보하고 작가의 경우 글쓰기를 마칩니다.

+0

와우, 그게 바보 같은 실수 야, 나는 독자를 닫고 있지만 작가는 닫지 않았다. 지금은 잘 작동하는 것 같습니다 :) 이제 수정하고 싶습니다. 고맙습니다 – Mac

관련 문제