jdk/test/sun/net/www/ftptest/FtpFileSystemHandler.java
author duke
Wed, 05 Jul 2017 16:48:18 +0200
changeset 2092 b86b8d6d48bd
parent 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 * Interface for managing the underlying file system
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
public interface FtpFileSystemHandler {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
     * Change current directory to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
     * Returns <code>true</code> if operation was successful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
     * @param path the path of the directory to change to, in either relative
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
     * or absolute form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
     * @return <code>true</code> if the operation was successful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
    public boolean cd(String path);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
     * Change current directory to parent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
     * @return <code>true</code> if the operation was successful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    public boolean cdUp();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
     * Print Working Directory. I.E. returns a string containing the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
     * working directory full path.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    public String pwd();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     * Tests if a specified file exists. Returns <code>true</code> if the file
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * does exist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     * @param name can be either a relative pathname or an absolute pathname.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * @return <code>true</code> if the file exists.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    public boolean fileExists(String name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * Get the content of a file. Returns an InputStream pointing to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * content of the file whose name was passed as an argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * Returns <code>null</code> if the operation failed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    public java.io.InputStream getFile(String name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * Returns the size, in bytes, of the specified file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * @param name the pathname, which can be either relative or absolute,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     *             of the file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * @return the size in bytes of the file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    public long getFileSize(String name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * Get the content of the current directory. Returns an InputStream
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * pointing to the content (in text form) of the current directory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * Returns <code>null</code> if the operation failed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    public java.io.InputStream listCurrentDir();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * Open a file for writing on the server and provides an OutputStream
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * pointing to it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * Returns <code>null</code> if the operation failed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    public java.io.OutputStream putFile(String name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * Remove the specified file on the server. Returns <code>true</code> if
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * the operation was successful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * @return <code>true</code> if the operation was successful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    public boolean removeFile(String name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * Creates a directory on the server. Returns <code>true</code> if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * operation was successful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * @param name the path of the directory to create, which can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * either in relative or absolute for.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * @return <code>true</code> if the operation was successful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    public boolean mkdir(String name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * Rename a file in the current working directory.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * Returns <code>true</code> if the operation was successful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * @param from the name of the file to rename.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * @param to the new name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * @return <code>true</code> if the operation was successful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    public boolean rename(String from, String to);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
}