Path: blob/master/test/jdk/sun/net/www/ftptest/FtpFileSystemHandler.java
41152 views
/*1* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* Interface for managing the underlying file system25*/2627public interface FtpFileSystemHandler {28/*29* Change current directory to.30* Returns <code>true</code> if operation was successful.31*32* @param path the path of the directory to change to, in either relative33* or absolute form.34* @return <code>true</code> if the operation was successful.35*/36public boolean cd(String path);37/*38* Change current directory to parent.39* @return <code>true</code> if the operation was successful.40*/41public boolean cdUp();42/*43* Print Working Directory. I.E. returns a string containing the current44* working directory full path.45*/46public String pwd();47/*48* Tests if a specified file exists. Returns <code>true</code> if the file49* does exist.50* @param name can be either a relative pathname or an absolute pathname.51* @return <code>true</code> if the file exists.52*/53public boolean fileExists(String name);54/*55* Get the content of a file. Returns an InputStream pointing to the56* content of the file whose name was passed as an argument.57* Returns <code>null</code> if the operation failed.58*/59public java.io.InputStream getFile(String name);60/*61* Returns the size, in bytes, of the specified file.62*63* @param name the pathname, which can be either relative or absolute,64* of the file.65* @return the size in bytes of the file.66*/67public long getFileSize(String name);68/*69* Get the content of the current directory. Returns an InputStream70* pointing to the content (in text form) of the current directory.71* Returns <code>null</code> if the operation failed.72*/73public java.io.InputStream listCurrentDir();74/*75* Open a file for writing on the server and provides an OutputStream76* pointing to it.77* Returns <code>null</code> if the operation failed.78*/79public java.io.OutputStream putFile(String name);80/*81* Remove the specified file on the server. Returns <code>true</code> if82* the operation was successful.83* @return <code>true</code> if the operation was successful.84*/85public boolean removeFile(String name);86/*87* Creates a directory on the server. Returns <code>true</code> if the88* operation was successful.89*90* @param name the path of the directory to create, which can be91* either in relative or absolute for.92* @return <code>true</code> if the operation was successful.93*/94public boolean mkdir(String name);95/*96* Rename a file in the current working directory.97* Returns <code>true</code> if the operation was successful.98*99* @param from the name of the file to rename.100* @param to the new name.101* @return <code>true</code> if the operation was successful.102*/103104public boolean rename(String from, String to);105}106107108