@Test public void testParse() { final List<String> list = new FTPStatListService(null, null).parse( 212, new String[]{" drwxr-xr-x 11 root root 8192 Dec 14 23:44 DK_BookStore"}); assertEquals(1, list.size()); }
protected List<String> parse(final int response, final String[] reply) { final List<String> result = new ArrayList<String>(reply.length); for(final String line : reply) { if(line.startsWith(String.valueOf(response))) { try { String stripped = line; stripped = StringUtils.strip(StringUtils.removeStart(stripped, String.valueOf(String.format("%d-", response)))); stripped = StringUtils.strip(StringUtils.removeStart(stripped, String.valueOf(response))); result.add(stripped); } catch(IndexOutOfBoundsException e) { log.error(String.format("Failed parsing line %s", line), e); } } else { result.add(StringUtils.strip(line)); } } return result; }
FTPStatListService implements ListService { protected List<String> parse(final int response, final String[] reply) { final List<String> result = new ArrayList<String>(reply.length); for(final String line : reply) { if(line.startsWith(String.valueOf(response))) { try { String stripped = line; stripped = StringUtils.strip(StringUtils.removeStart(stripped, String.valueOf(String.format("%d-", response)))); stripped = StringUtils.strip(StringUtils.removeStart(stripped, String.valueOf(response))); result.add(stripped); } catch(IndexOutOfBoundsException e) { log.error(String.format("Failed parsing line %s", line), e); } } else { result.add(StringUtils.strip(line)); } } return result; } }
FTPStatListService implements ListService { protected List<String> parse(final int response, final String[] reply) { final List<String> result = new ArrayList<String>(reply.length); for(final String line : reply) { if(line.startsWith(String.valueOf(response))) { try { String stripped = line; stripped = StringUtils.strip(StringUtils.removeStart(stripped, String.valueOf(String.format("%d-", response)))); stripped = StringUtils.strip(StringUtils.removeStart(stripped, String.valueOf(response))); result.add(stripped); } catch(IndexOutOfBoundsException e) { log.error(String.format("Failed parsing line %s", line), e); } } else { result.add(StringUtils.strip(line)); } } return result; } FTPStatListService(final FTPSession session, final FTPFileEntryParser parser); }
FTPStatListService implements ListService { protected List<String> parse(final int response, final String[] reply) { final List<String> result = new ArrayList<String>(reply.length); for(final String line : reply) { if(line.startsWith(String.valueOf(response))) { try { String stripped = line; stripped = StringUtils.strip(StringUtils.removeStart(stripped, String.valueOf(String.format("%d-", response)))); stripped = StringUtils.strip(StringUtils.removeStart(stripped, String.valueOf(response))); result.add(stripped); } catch(IndexOutOfBoundsException e) { log.error(String.format("Failed parsing line %s", line), e); } } else { result.add(StringUtils.strip(line)); } } return result; } FTPStatListService(final FTPSession session, final FTPFileEntryParser parser); @Override AttributedList<Path> list(final Path directory, final ListProgressListener listener); }
FTPStatListService implements ListService { protected List<String> parse(final int response, final String[] reply) { final List<String> result = new ArrayList<String>(reply.length); for(final String line : reply) { if(line.startsWith(String.valueOf(response))) { try { String stripped = line; stripped = StringUtils.strip(StringUtils.removeStart(stripped, String.valueOf(String.format("%d-", response)))); stripped = StringUtils.strip(StringUtils.removeStart(stripped, String.valueOf(response))); result.add(stripped); } catch(IndexOutOfBoundsException e) { log.error(String.format("Failed parsing line %s", line), e); } } else { result.add(StringUtils.strip(line)); } } return result; } FTPStatListService(final FTPSession session, final FTPFileEntryParser parser); @Override AttributedList<Path> list(final Path directory, final ListProgressListener listener);  }