2010-01-19 3 views

답변

2

기본적으로 복사 할 리소스 파일 목록이 필요합니다. 당신이 사용하는 것들

public class CopyUtil { 

    public void doTheCopy(List<String> resourceNames) { 

    for (String resource : resourceNames) { 
     InputStream is = this.getClass().getClassLoader().getResourceAsStream(resource); 
     FileOutputStream fos = 
     new FileOutputStream(new File(System.getProperty("user.dir"), resource)); 
     byte[] buffer = new byte[1024]; 
     int read = -1; 
     while((read = is.read(buffer)) != -1) { 
     fos.write(buffer,0,read); 
     } 
     fos.flush(); 
     fos.close(); 
    } 
    } 
} 
+0

이것은 정적 방법이어야합니다. – Jherico

관련 문제