@Test public void testList() throws Exception { final ListService service = new FTPStatListService(session, new CompositeFileEntryParser(Collections.singletonList(new UnixFTPEntryParser()))); final Path directory = new FTPWorkdirService(session).find(); final Path file = new Path(directory, new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); new FTPTouchFeature(session).touch(file, new TransferStatus()); final AttributedList<Path> list = service.list(directory, new DisabledListProgressListener()); assertTrue(list.contains(file)); }
@Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { try { final int response = session.getClient().stat(directory.getAbsolute()); if(FTPReply.isPositiveCompletion(response)) { return reader.read(directory, this.parse(response, session.getClient().getReplyStrings()), listener); } else { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } } catch(IOException e) { throw new FTPExceptionMappingService().map("Listing directory {0} failed", e, directory); } }
FTPStatListService implements ListService { @Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { try { final int response = session.getClient().stat(directory.getAbsolute()); if(FTPReply.isPositiveCompletion(response)) { return reader.read(directory, this.parse(response, session.getClient().getReplyStrings()), listener); } else { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } } catch(IOException e) { throw new FTPExceptionMappingService().map("Listing directory {0} failed", e, directory); } } }
FTPStatListService implements ListService { @Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { try { final int response = session.getClient().stat(directory.getAbsolute()); if(FTPReply.isPositiveCompletion(response)) { return reader.read(directory, this.parse(response, session.getClient().getReplyStrings()), listener); } else { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } } catch(IOException e) { throw new FTPExceptionMappingService().map("Listing directory {0} failed", e, directory); } } FTPStatListService(final FTPSession session, final FTPFileEntryParser parser); }
FTPStatListService implements ListService { @Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { try { final int response = session.getClient().stat(directory.getAbsolute()); if(FTPReply.isPositiveCompletion(response)) { return reader.read(directory, this.parse(response, session.getClient().getReplyStrings()), listener); } else { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } } catch(IOException e) { throw new FTPExceptionMappingService().map("Listing directory {0} failed", e, directory); } } FTPStatListService(final FTPSession session, final FTPFileEntryParser parser); @Override AttributedList<Path> list(final Path directory, final ListProgressListener listener); }
FTPStatListService implements ListService { @Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { try { final int response = session.getClient().stat(directory.getAbsolute()); if(FTPReply.isPositiveCompletion(response)) { return reader.read(directory, this.parse(response, session.getClient().getReplyStrings()), listener); } else { throw new FTPException(session.getClient().getReplyCode(), session.getClient().getReplyString()); } } catch(IOException e) { throw new FTPExceptionMappingService().map("Listing directory {0} failed", e, directory); } } FTPStatListService(final FTPSession session, final FTPFileEntryParser parser); @Override AttributedList<Path> list(final Path directory, final ListProgressListener listener);  }