public class EgovFileUtil extends Object
NOTE: 파일 서비스를 제공하기 위해 구현한 클래스이다.
== 개정이력(Modification Information) == 수정일 수정자 수정내용 ------- -------- --------------------------- 2009.06.01 윤성종 최초 생성 2014.05.14 이기하 vfs -> vfs2로 패키지 변경
| Constructor and Description |
|---|
EgovFileUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
cd(String changDirectory)
현재 작업공간의 위치를 지정한 위치로 이동한다.
|
static void |
copyContent(org.apache.commons.vfs2.FileObject srcFile,
org.apache.commons.vfs2.FileObject destFile)
파일 객체를 대상 파일객체로 복사한다.
|
static void |
cp(String source,
String target)
지정한 위치의 파일을 대상 위치로 복사한다.
|
static void |
delete(File file)
저정한 파일을 삭제한다.
|
static byte[] |
getContent(org.apache.commons.vfs2.FileObject file)
byte형으로 파일의 내용을 읽어온다.
|
static String |
getFileExtension(String filename)
파일의 확장자를 가져온다.
|
static org.apache.commons.vfs2.FileObject |
getFileObject(String filepath)
특정위치의 파일 객체를 가져온다.
|
static String |
getTmpDirectory()
시스템 임시 디렉토리를 얻어온다.
|
static List<String> |
grep(File file,
String pattern)
특정 패턴이 존재하는 파일을 검색한다.
|
static List<String> |
grep(Object[] search,
String pattern)
특정 패턴이 존재하는 파일을 검색한다.
|
static boolean |
isExistsFile(String filename)
파일의 존재여부를 확인한다.
|
List<?> |
ls(String[] cmd)
지정한 위치의 파일목록을 조회한다.
|
static void |
mv(String source,
String target)
지정한 위치의 파일을 대상 위치로 이동한다.
|
static org.apache.commons.vfs2.FileName |
pwd()
현재 작업위치를 리턴한다.
|
static String |
readFile(File file)
파일을 읽는다.
|
static String |
readFile(File file,
String encoding)
String 영으로 파일의 내용을 읽는다.
|
static String |
readFileContent(InputStream in)
String 형으로 파일의 내용을 읽는다.
|
static StringBuffer |
readTextFile(String fileName,
boolean newline)
텍스트 파일을 읽어온다.
|
static int |
rm(String cmd)
지정한 위치의 파일 및 디렉토리를 삭제한다.
|
static String |
stripFilename(String filename)
디렉토리명을 제외한 파일명을 가져온다.
|
static long |
touch(String filepath)
파일의 일시를 현재 일시로 변경한다.
|
static void |
writeContent(org.apache.commons.vfs2.FileObject file,
OutputStream outstr)
내용을 파일에 OutputStream 으로 저장한다.
|
static void |
writeFile(File file,
String text)
텍스트 내용을 파일로 쓴다.
|
static void |
writeFile(String fileName,
String text)
텍스트 내용을 파일로 쓴다.
|
static void |
writeFile(String fileName,
String data,
String encoding) |
public static int rm(String cmd) throws org.apache.commons.vfs2.FileSystemException
cmd - Stringorg.apache.commons.vfs2.FileSystemExceptionpublic static void cp(String source, String target) throws Exception
source - Stringtarget - StringExceptionpublic static void mv(String source, String target) throws Exception
source - Stringtarget - StringExceptionpublic static org.apache.commons.vfs2.FileName pwd()
public static long touch(String filepath) throws Exception
filepath - StringExceptionpublic static void cd(String changDirectory) throws Exception
changDirectory - StringExceptionpublic List<?> ls(String[] cmd) throws org.apache.commons.vfs2.FileSystemException
cmd - String[]org.apache.commons.vfs2.FileSystemExceptionpublic static String readFile(File file) throws IOException
file - FileIOExceptionpublic static String readFileContent(InputStream in) throws IOException
the - file input stream InputStreaIOExceptionpublic static String readFile(File file, String encoding) throws IOException
file - Fileencoding - StringIOExceptionpublic static void writeFile(File file, String text)
file - Filetext - Stringpublic static void writeFile(String fileName, String text)
fileName - Stringtext - Stringpublic static void writeFile(String fileName, String data, String encoding) throws IOException
IOExceptionpublic static byte[] getContent(org.apache.commons.vfs2.FileObject file)
throws IOException
file - FileObjectIOExceptionpublic static void writeContent(org.apache.commons.vfs2.FileObject file,
OutputStream outstr)
throws IOException
file - outstr - IOExceptionpublic static void copyContent(org.apache.commons.vfs2.FileObject srcFile,
org.apache.commons.vfs2.FileObject destFile)
throws IOException
srcFile - FileObjectdestFile - FileObjectIOExceptionpublic static String getFileExtension(String filename)
filename - Stringpublic static boolean isExistsFile(String filename)
filename - Stringpublic static String stripFilename(String filename)
filename - Stringpublic static void delete(File file) throws IOException
file - FileIOExceptionpublic static StringBuffer readTextFile(String fileName, boolean newline) throws FileNotFoundException, IOException
fileName - Stringnewline - booleanFileNotFoundExceptionIOExceptionpublic static org.apache.commons.vfs2.FileObject getFileObject(String filepath) throws Exception
filepath - StringExceptionpublic static List<String> grep(Object[] search, String pattern) throws Exception
search - Object[]pattern - StringExceptionpublic static List<String> grep(File file, String pattern) throws Exception
file - Filepattern - StringExceptionpublic static String getTmpDirectory() throws IOException
IOExceptionCopyright © 2015. All rights reserved.