0

Java ftp クライアントのコードを調べていましたが、1 つの方法で this.-operator が使用されていて、意味がわかりません。「this.processFtpRequest」は何の略ですか?

     * Initializes the FTP control connection.
 * @param alias the user-ID
 * @param binaryMode true for binary transmission, false for ASCII
 * @throws SecurityException if the given alias or password is invalid
 * @throws IOException if there is an I/O related problem
 */
private synchronized void initialize(final String alias, final String password, final boolean binaryMode) throws IOException {
    FtpResponse ftpResponse = FtpResponse.parse(this.controlConnectionSource);
    Logger.getGlobal().log(Level.INFO, ftpResponse.toString());
    if (ftpResponse.getCode() != 220) throw new ProtocolException(ftpResponse.toString());

    ftpResponse = this.processFtpRequest("USER " + (alias == null ? "guest" : alias));
    if (ftpResponse.getCode() == 331) {
        ftpResponse = this.processFtpRequest("PASS " + (password == null ? "" : password));
    }
    if (ftpResponse.getCode() != 230) throw new SecurityException(ftpResponse.toString());

    ftpResponse = this.processFtpRequest("TYPE " + (binaryMode ? "I" : "A"));
    if (ftpResponse.getCode() != 200) throw new ProtocolException(ftpResponse.toString());
}
4

1 に答える 1

4

Javaチュートリアルから:

インスタンス メソッドまたはコンストラクター内では、現在のオブジェクト (メソッドまたはコンストラクターが呼び出されているオブジェクト)thisへの参照です。を使用して、インスタンス メソッドまたはコンストラクター内から現在のオブジェクトの任意のメンバーを参照できます。this

そのため、現在のオブジェクトのインスタンス メソッドthis.processFtpRequest(...)を呼び出します。

于 2013-05-06T21:22:46.250 に答える