0
이 코드를 사용하여 파일에 쓰고 있습니다.블랙 베리 파일 읽기/쓰기
protected void writeFile(String text) {
DataOutputStream os = null;
FileConnection fconn = null;
try {
fconn = (FileConnection) Connector.open("file:///store/home/user/documents/file.txt", Connector.READ_WRITE);
if (!fconn.exists())
fconn.create();
os = fconn.openDataOutputStream();
os.write(text.getBytes());
} catch (IOException e) {
System.out.println(e.getMessage());
} finally {
try {
if (null != os)
os.close();
if (null != fconn)
fconn.close();
} catch (IOException e) {
System.out.println(e.getMessage());
}
}}
코드가 정상적으로 작동합니다.
제가 처음으로 "Banglore"라고 쓰면 저의 문제는 제가 읽을 때 "Banglore"를 얻는 것입니다. 하지만 두 번째로 "인도"라고 쓰고 읽을 때 "Indialore"라고합니다. 그래서 기본적으로 내용은 텍스트에 따라 변경되지 않습니다. 해결 방법을 알려주십시오.
감사합니다. – user2218773