파일 조작을 수행하려면 먼저 파일이있는 디렉토리로 변경해야합니다. 당신은/루트/디렉토리에 도착해야하는 경우 exampe를 들어 ,/하위 디렉터리/ 당신은 setPath 세 번
setPath(""); // to get to /root/
setPath("directory") // get to /root/directory/
setPath("subdir") // get to root/directory/subdir/
를 호출해야합니다 모든 아래 작성된 코드는 J2ME 을 위해 내가 분리기와 경로를 설정하려면이 방법을 사용하는 것입니다 (예 :/루트/디렉토리 /)
private void moveToDirectory(String dir) throws IOException {
RE r = new RE("/"); // where RE is me.regexp.RE
setDir("");
String[] dirs = r.split(dir);
for (int i = 1; i < dirs.length; i++) setDir(dirs[i]);
}
당신이 그것에 PUT 조작을 열고 닫습니다, 또는대로 ClientSession의 삭제 방법을 사용해야합니다 파일을 삭제합니다. 당신이 파일을 교체해야하는 경우
public void delete() throws IOException {
HeaderSet hs = cs.createHeaderSet(); // where cs is an opened ClientSession
hs.setHeader(HeaderSet.NAME, file); // file - is a filename String, no slashes should be used
cs.delete(hs);
}
당신은 아마, 방법을 삭제 전화를 열어 OutputStream에 필요하고 그것을 기록하지 않는 새
public OutputStream openOutputStream() throws IOException {
HeaderSet hs = cs.createHeaderSet();
hs.setHeader(HeaderSet.NAME, file);
Operation op = cs.put(hs); // Operation should be global, so you can close it after you done
return op.openOutputStream();
}
당신이 수행 한 후 작업을 닫습니다 기억 개울.