2362N/A * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 1789N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1789N/A * This code is free software; you can redistribute it and/or modify it 1789N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 1789N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 1789N/A * This code is distributed in the hope that it will be useful, but WITHOUT 1789N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1789N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1789N/A * version 2 for more details (a copy is included in the LICENSE file that 1789N/A * You should have received a copy of the GNU General Public License version 1789N/A * 2 along with this work; if not, write to the Free Software Foundation, 1789N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 1789N/A * A {@code FtpDirEntry} is a class agregating all the information that the FTP client 1789N/A * can gather from the server by doing a {@code LST} (or {@code NLST}) command and 1789N/A * parsing the output. It will typically contain the name, type, size, last modification 1789N/A * time, owner and group of the file, although some of these could be unavailable 1789N/A * due to specific FTP server limitations. 1789N/A * @see sun.net.ftp.FtpDirParser 1789N/A * Creates an FtpDirEntry instance with only the name being set. 1789N/A * @param name The name of the file 1789N/A * Returns the name of the remote file. 1789N/A * @return a {@code String} containing the name of the remote file. 1789N/A * Returns the user name of the owner of the file as returned by the FTP 1789N/A * server, if provided. This could be a name or a user id (number). 1789N/A * @return a {@code String} containing the user name or 1789N/A * {@code null} if that information is not available. 1789N/A * Sets the user name of the owner of the file. Intended mostly to be 1789N/A * used from inside a {@link java.net.FtpDirParser} implementation. 1789N/A * @param user The user name of the owner of the file, or {@code null} 1789N/A * if that information is not available. 1789N/A * Returns the group name of the file as returned by the FTP 1789N/A * server, if provided. This could be a name or a group id (number). 1789N/A * @return a {@code String} containing the group name or 1789N/A * {@code null} if that information is not available. 1789N/A * Sets the name of the group to which the file belong. Intended mostly to be 1789N/A * used from inside a {@link java.net.FtpDirParser} implementation. 1789N/A * @param group The name of the group to which the file belong, or {@code null} 1789N/A * if that information is not available. 1789N/A * Returns the size of the remote file as it was returned by the FTP 1789N/A * @return the size of the file or -1 if that information is not available. 1789N/A * Sets the size of that file. Intended mostly to be used from inside an 1789N/A * {@link java.net.FtpDirParser} implementation. 1789N/A * @param size The size, in bytes, of that file. or -1 if unknown. 1789N/A * Returns the type of the remote file as it was returned by the FTP 1789N/A * It returns a FtpDirEntry.Type enum and the values can be: 1789N/A * - FtpDirEntry.Type.FILE for a normal file 1789N/A * - FtpDirEntry.Type.DIR for a directory 1789N/A * - FtpDirEntry.Type.LINK for a symbolic link 1789N/A * @return a {@code FtpDirEntry.Type} describing the type of the file 1789N/A * or {@code null} if that information is not available. 1789N/A * Sets the type of the file. Intended mostly to be used from inside an 1789N/A * {@link java.net.FtpDirParser} implementation. 1789N/A * @param type the type of this file or {@code null} if that information 1789N/A * Returns the last modification time of the remote file as it was returned 1789N/A * by the FTP server, if provided, {@code null} otherwise. 1789N/A * @return a <code>Date</code> representing the last time the file was 1789N/A * modified on the server, or {@code null} if that 1789N/A * information is not available. 1789N/A * Sets the last modification time of the file. Intended mostly to be used 1789N/A * from inside an {@link java.net.FtpDirParser} implementation. 1789N/A * @param lastModified The Date representing the last modification time, or 1789N/A * {@code null} if that information is not available. 1789N/A * Returns whether read access is granted for a specific permission. 1789N/A * @param p the Permission (user, group, others) to check. 1789N/A * @return {@code true} if read access is granted. 1789N/A * Returns whether write access is granted for a specific permission. 1789N/A * @param p the Permission (user, group, others) to check. 1789N/A * @return {@code true} if write access is granted. 1789N/A * Returns whether execute access is granted for a specific permission. 1789N/A * @param p the Permission (user, group, others) to check. 1789N/A * @return {@code true} if execute access is granted. 1789N/A * Sets the permissions for that file. Intended mostly to be used 1789N/A * from inside an {@link java.net.FtpDirParser} implementation. 1789N/A * The permissions array is a 3x3 {@code boolean} array, the first index being 1789N/A * the User, group or owner (0, 1 and 2 respectively) while the second 1789N/A * index is read, write or execute (0, 1 and 2 respectively again). 1789N/A * @param permissions a 3x3 {@code boolean} array 1789N/A * @return this {@code FtpDirEntry} 1789N/A * Adds a 'fact', as defined in RFC 3659, to the list of facts of this file. 1789N/A * Intended mostly to be used from inside a {@link java.net.FtpDirParser} 1789N/A * @param fact the name of the fact (e.g. "Media-Type"). It is not case-sensitive. 1789N/A * @param value the value associated with this fact. 1789N/A * @return this {@code FtpDirEntry} 1789N/A * Returns the requested 'fact', as defined in RFC 3659, if available. 1789N/A * @param fact The name of the fact *e.g. "Media-Type"). It is not case sensitive. 1789N/A * @return The value of the fact or, {@code null} if that fact wasn't 1789N/A * Returns the creation time of the file, when provided by the server. 1789N/A * @return The Date representing the creation time, or {@code null} 1789N/A * if the server didn't provide that information. 1789N/A * Sets the creation time for that file. Intended mostly to be used from 1789N/A * inside a {@link java.net.FtpDirParser} implementation. 1789N/A * @param created the Date representing the creation time for that file, or 1789N/A * {@code null} if that information is not available. 1789N/A * Returns a string representation of the object. 1789N/A * The {@code toString} method for class {@code FtpDirEntry} 1789N/A * returns a string consisting of the name of the file, followed by its 1789N/A * type between brackets, followed by the user and group between 1789N/A * parenthesis, then size between '{', and, finally, the lastModified of last 1789N/A * modification if it's available. 1789N/A * @return a string representation of the object.