/** * Initiate list parsing for MLSD listings. * * @param pathname * @return the engine * @throws java.io.IOException */ private FTPListParseEngine initiateMListParsing(String pathname) throws IOException { Socket socket = _openDataConnection_(FTPCmd.MLSD, pathname); FTPListParseEngine engine = new FTPListParseEngine(MLSxEntryParser.getInstance()); if (socket == null) { return engine; } try { engine.readServerList(socket.getInputStream(), getControlEncoding()); } finally { Util.closeQuietly(socket); completePendingCommand(); } return engine; }
/** * Initiate list parsing for MLSD listings. * * @param pathname * @return the engine * @throws IOException */ private FTPListParseEngine initiateMListParsing(String pathname) throws IOException { Socket socket = _openDataConnection_(FTPCommand.MLSD, pathname); FTPListParseEngine engine = new FTPListParseEngine(MLSxEntryParser.getInstance()); if (socket == null) { return engine; } try { engine.readServerList(socket.getInputStream(), getControlEncoding()); } finally { Util.closeQuietly(socket); completePendingCommand(); } return engine; }
private FTPListParseEngine initiateMListParsing(String pathname) throws IOException { Socket socket = this._openDataConnection_(38, pathname); FTPListParseEngine engine = new FTPListParseEngine(MLSxEntryParser.getInstance()); if(socket == null) { return engine; } else { try { engine.readServerList(socket.getInputStream(), this.getControlEncoding()); } finally { Util.closeQuietly(socket); this.completePendingCommand(); } return engine; } }
/** * Get file details using the MLST command * * @param pathname the file or directory to list, may be {@code null} * @return the file details, may be {@code null} * @throws IOException on error * @since 3.0 */ public FTPFile mlistFile(String pathname) throws IOException { boolean success = FTPReply.isPositiveCompletion(sendCommand(FTPCmd.MLST, pathname)); if (success) { String reply = getReplyStrings()[1]; /* check the response makes sense. * Must have space before fact(s) and between fact(s) and filename * Fact(s) can be absent, so at least 3 chars are needed. */ if (reply.length() < 3 || reply.charAt(0) != ' ') { throw new MalformedServerReplyException("Invalid server reply (MLST): '" + reply + "'"); } String entry = reply.substring(1); // skip leading space for parser return MLSxEntryParser.parseEntry(entry); } else { return null; } }
/** * Initiate list parsing for MLSD listings. * * @return the engine * @throws IOException */ private FTPListParseEngine initiateMListParsing(String pathname) throws IOException { Socket socket = _openDataConnection_(FTPCmd.MLSD, pathname); FTPListParseEngine engine = new FTPListParseEngine(MLSxEntryParser.getInstance(), __configuration); if (socket == null) { return engine; } try { engine.readServerList(socket.getInputStream(), getControlEncoding()); } finally { Util.closeQuietly(socket); completePendingCommand(); } return engine; }
/** * Get file details using the MLST command * * @param pathname the file or directory to list, may be {@code} null * @return the file details, may be {@code null} * @throws java.io.IOException * @since 3.0 */ public FTPFile mlistFile(String pathname) throws IOException { boolean success = FTPReply.isPositiveCompletion(sendCommand(FTPCmd.MLST, pathname)); if (success){ String entry = getReplyStrings()[1].substring(1); // skip leading space for parser return MLSxEntryParser.parseEntry(entry); } else { return null; } }
/** * Get file details using the MLST command * * @param pathname the file or directory to list, may be {@code} null * @return the file details, may be {@code null} * @throws IOException * @since 3.0 */ public FTPFile mlistFile(String pathname) throws IOException { boolean success = FTPReply.isPositiveCompletion(sendCommand(FTPCommand.MLST, pathname)); if (success){ String entry = getReplyStrings()[1].substring(1); // skip leading space for parser return MLSxEntryParser.parseEntry(entry); } else { return null; } }
public FTPFile mlistFile(String pathname) throws IOException { boolean success = FTPReply.isPositiveCompletion(this.sendCommand(39, pathname)); if(success) { String entry = this.getReplyStrings()[1].substring(1); return MLSxEntryParser.parseEntry(entry); } else { return null; } }
/** * Issue the FTP MDTM command (not supported by all servers) to retrieve the last * modification time of a file. The modification string should be in the * ISO 3077 form "YYYYMMDDhhmmss(.xxx)?". The timestamp represented should also be in * GMT, but not all FTP servers honour this. * * @param pathname The file path to query. * @return A FTPFile representing the last file modification time, may be {@code null}. * The FTPFile timestamp will be null if a parse error occurs. * @throws IOException if an I/O error occurs. * @since 3.4 */ public FTPFile mdtmFile(String pathname) throws IOException { if (FTPReply.isPositiveCompletion(mdtm(pathname))) { String reply = getReplyStrings()[0].substring(4); // skip the return code (e.g. 213) and the space FTPFile file = new FTPFile(); file.setName(pathname); file.setRawListing(reply); file.setTimestamp(MLSxEntryParser.parseGMTdateTime(reply)); return file; } return null; }