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