안드로이드 개발 질문/답변
(글 수 45,052)
서버에 A 라는 폴더를 통째로 가지고와서 저장하고 싶은데요.
특정 파일만 가지고 오는것은 되는데요.. 폴더 가지고 오는 것은 감이 안오네요..ㅠ
소스는 아래와 같습니다. 도와주세요..
try{
String folderurl = "http://www.특정주소/A"; //A라는 폴더
InputStream inputStream = new URL("folderurl).openStream();
File file = new File(savePath+"/A"); //savePath 는 저장될 위치
OutputStream out = new FileOutputStream(file);
saveRemoteFile(inputStream, out);
out.close();
}catch(Exception e){;}
public void saveRemoteFile(InputStream is, OutputStream os) throws IOException
{
int c =0;
while((c=is.read())!=-1){
os.write(c);
}
os.flush();
}
특정 파일만 가지고 오는것은 되는데요.. 폴더 가지고 오는 것은 감이 안오네요..ㅠ
소스는 아래와 같습니다. 도와주세요..
try{
String folderurl = "http://www.특정주소/A"; //A라는 폴더
InputStream inputStream = new URL("folderurl).openStream();
File file = new File(savePath+"/A"); //savePath 는 저장될 위치
OutputStream out = new FileOutputStream(file);
saveRemoteFile(inputStream, out);
out.close();
}catch(Exception e){;}
public void saveRemoteFile(InputStream is, OutputStream os) throws IOException
{
int c =0;
while((c=is.read())!=-1){
os.write(c);
}
os.flush();
}




불가능한 개념입니다.
URI는 / 구분자는 폴더를 의미하는게 아닙니다.
URI 정의를 살펴보세요. http://en.wikipedia.org/wiki/Uniform_resource_identifier