com.xebialabs.deployit.hostsession.cifs
Class CifsHostFile

java.lang.Object
  extended by com.xebialabs.deployit.hostsession.common.AbstractHostFile
      extended by com.xebialabs.deployit.hostsession.cifs.CifsHostFile
All Implemented Interfaces:
HostFile

public class CifsHostFile
extends AbstractHostFile
implements HostFile


Field Summary
 
Fields inherited from class com.xebialabs.deployit.hostsession.common.AbstractHostFile
session
 
Method Summary
 boolean canExecute()
          Tests whether the file or directory can be executed.
 boolean canRead()
          Tests whether the file or directory can be read.
 boolean canWrite()
          Tests whether the file or directory can be written.
 boolean delete()
          Deletes the host file or directory.
 boolean deleteRecursively()
          Deletes the host directory recursively, first deleting its contents and then the directory itself.
 boolean exists()
          Tests whether the file or directory exists.
 java.io.InputStream get()
          Opens the host file for reading.
 java.lang.String getName()
          Returns the name of the host file or directory.
 java.lang.String getParent()
          Returns the path of the parent of the host file or directory.
 java.lang.String getPath()
          Returns the path.
 boolean isDirectory()
          Tests whether this file is a directory.
 long length()
          Returns the length of this file.
 java.util.List<java.lang.String> list()
          Returns a list of strings naming the files and directories contained by the host directory.
 void mkdir()
          Creates the directory on the host.
 void mkdirs()
          Creates the directory on the host, including any missing parent directories if needed.
 void moveTo(HostFile destFile)
          Moves/renames this file to the target file atomically.
 java.io.OutputStream put(long length)
          Opens the host file for writing.
 java.lang.String toString()
           
 
Methods inherited from class com.xebialabs.deployit.hostsession.common.AbstractHostFile
deleteRecursively, get, get, getFile, getParentFile, getSession, listFiles, put, put, put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.xebialabs.deployit.hostsession.HostFile
deleteRecursively, get, get, getFile, getParentFile, getSession, listFiles, put, put, put
 

Method Detail

getName

public java.lang.String getName()
Description copied from interface: HostFile
Returns the name of the host file or directory.

Specified by:
getName in interface HostFile

getParent

public java.lang.String getParent()
Description copied from interface: HostFile
Returns the path of the parent of the host file or directory. The parent is the directory containing this file or directory. Returns the empty string if the host file or directory has no parent.

Specified by:
getParent in interface HostFile

getPath

public java.lang.String getPath()
Description copied from interface: HostFile
Returns the path.

Specified by:
getPath in interface HostFile
Returns:
the path

exists

public boolean exists()
               throws RuntimeIOException
Description copied from interface: HostFile
Tests whether the file or directory exists.

Specified by:
exists in interface HostFile
Returns:
true if and only if the file or directory exists on the host; false otherwise
Throws:
RuntimeIOException - if an I/O error occurs

isDirectory

public boolean isDirectory()
                    throws RuntimeIOException
Description copied from interface: HostFile
Tests whether this file is a directory.

Specified by:
isDirectory in interface HostFile
Returns:
true if and only if the file exists and is a directory; false otherwise
Throws:
RuntimeIOException - if an I/O error occurs

canExecute

public boolean canExecute()
                   throws RuntimeIOException
Description copied from interface: HostFile
Tests whether the file or directory can be executed.

Specified by:
canExecute in interface HostFile
Returns:
true if and only if the file or directory is executable on the host; false otherwise
Throws:
RuntimeIOException - if an I/O error occurs

canRead

public boolean canRead()
                throws RuntimeIOException
Description copied from interface: HostFile
Tests whether the file or directory can be read.

Specified by:
canRead in interface HostFile
Returns:
true if and only if the file or directory is readable on the host; false otherwise
Throws:
RuntimeIOException - if an I/O error occurs

canWrite

public boolean canWrite()
                 throws RuntimeIOException
Description copied from interface: HostFile
Tests whether the file or directory can be written.

Specified by:
canWrite in interface HostFile
Returns:
true if and only if the file or directory is writable on the host; false otherwise
Throws:
RuntimeIOException - if an I/O error occurs

length

public long length()
            throws RuntimeIOException
Description copied from interface: HostFile
Returns the length of this file.

Specified by:
length in interface HostFile
Returns:
the size of this file in bytes.
Throws:
RuntimeIOException - if an I/O error occurs

list

public java.util.List<java.lang.String> list()
                                      throws RuntimeIOException
Description copied from interface: HostFile
Returns a list of strings naming the files and directories contained by the host directory. Names denoting the directory itself and the directory's parent directory are not included in the result. Each string is a file name rather than a complete path.

Specified by:
list in interface HostFile
Returns:
An list of strings naming the files and directories in the host directory. The list will be empty if the directory is empty.
Throws:
RuntimeIOException - if an I/O error occurs or this file does not denote a directory.

mkdir

public void mkdir()
           throws RuntimeIOException
Description copied from interface: HostFile
Creates the directory on the host.

Specified by:
mkdir in interface HostFile
Throws:
RuntimeIOException - if an I/O error occurs

mkdirs

public void mkdirs()
            throws RuntimeIOException
Description copied from interface: HostFile
Creates the directory on the host, including any missing parent directories if needed.

Specified by:
mkdirs in interface HostFile
Throws:
RuntimeIOException - if an I/O error occurs

moveTo

public void moveTo(HostFile destFile)
            throws RuntimeIOException
Description copied from interface: HostFile
Moves/renames this file to the target file atomically.

Specified by:
moveTo in interface HostFile
Parameters:
destFile - the destination file.
Throws:
RuntimeIOException - if an I/O error occurs or the underlying implementation cannot move/rename the file.

delete

public boolean delete()
               throws RuntimeIOException
Description copied from interface: HostFile
Deletes the host file or directory. If the file or directory does not exists on the host, false is returned.

Specified by:
delete in interface HostFile
Returns:
true if the host file or directory existed before the deletion; false otherwise
Throws:
RuntimeIOException - if an I/O error occurs

deleteRecursively

public boolean deleteRecursively()
                          throws RuntimeIOException
Description copied from interface: HostFile
Deletes the host directory recursively, first deleting its contents and then the directory itself. If the host directory is actually a file, invoking this method is identical to invoking the HostFile.delete() method. If the directory does not exists on the host, false is returned.

Specified by:
deleteRecursively in interface HostFile
Overrides:
deleteRecursively in class AbstractHostFile
Returns:
true if the host file or directory existed before the deletion; false otherwise
Throws:
RuntimeIOException - if an I/O error occurs

get

public java.io.InputStream get()
                        throws RuntimeIOException
Description copied from interface: HostFile
Opens the host file for reading.

Specified by:
get in interface HostFile
Returns:
the InputStream connected to the file.
Throws:
RuntimeIOException - if an I/O error occurs

put

public java.io.OutputStream put(long length)
                         throws RuntimeIOException
Description copied from interface: HostFile
Opens the host file for writing.

Specified by:
put in interface HostFile
Parameters:
length - the number of bytes that will be written to the stream
Returns:
the OutputStream connected to the file.
Throws:
RuntimeIOException - if an I/O error occurs

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2010. All Rights Reserved.