1 16 package org.apache.commons.net.ftp; 17 import java.io.BufferedReader ; 18 import java.io.IOException ; 19 import java.io.InputStream ; 20 import java.util.Iterator ; 21 import java.util.List ; 22 23 29 public abstract class FTPFileEntryParserImpl 30 implements FTPFileEntryParser, FTPFileListParser 31 { 32 35 public FTPFileEntryParserImpl() 36 { 37 } 38 39 40 54 public FTPFile[] parseFileList(InputStream listStream, String encoding) throws IOException 55 { 56 FTPFileList ffl = FTPFileList.create(listStream, this, encoding); 57 return ffl.getFiles(); 58 59 } 60 61 77 public FTPFile[] parseFileList(InputStream listStream) throws IOException 78 { 79 return parseFileList(listStream, null); 80 } 81 82 93 public String readNextEntry(BufferedReader reader) throws IOException 94 { 95 return reader.readLine(); 96 } 97 109 public List preParse(List original) { 110 Iterator it = original.iterator(); 111 while (it.hasNext()){ 112 String entry = (String ) it.next(); 113 if (null == parseFTPEntry(entry)) { 114 it.remove(); 115 } else { 116 break; 117 } 118 } 119 return original; 120 } 121 } 122 123 130 | Popular Tags |