org.netbeans.lib.cvsclient.file
Interface FileHandler

All Known Implementing Classes:
DefaultFileHandler, GzippedFileHandler

public interface FileHandler

Handles the reading and writing of files to and from the server. Different implementations of this interface can use different formats for sending or receiving the files, for example gzipped format.


Method Summary
 Request[] getInitialisationRequests()
          Get any requests that must be sent before commands are sent, to init this file handler.
 void removeLocalFile(java.lang.String pathname)
          Remove the specified file from the local disk.
 void renameLocalFile(java.lang.String pathname, java.lang.String newName)
          Rename the local file If the destination file exists, the operation does nothing.
 void setGlobalOptions(GlobalOptions globalOptions)
          Sets the global options.
 void setNextFileDate(java.util.Date modifiedDate)
          Set the modified date of the next file to be written.
 void transmitBinaryFile(java.io.File file, LoggedDataOutputStream dos)
          Transmit a binary file to the server, using the standard CVS protocol conventions.
 void transmitTextFile(java.io.File file, LoggedDataOutputStream dos)
          Transmit a text file to the server, using the standard CVS protocol conventions.
 void writeBinaryFile(java.lang.String path, java.lang.String mode, LoggedDataInputStream dis, int length)
          Write (either create or replace) a text file on the local machine with one read from the server.
 void writeRcsDiffFile(java.lang.String path, java.lang.String mode, LoggedDataInputStream dis, int length)
          Merge a text file on the local machine with the diff from the server.
 void writeTextFile(java.lang.String path, java.lang.String mode, LoggedDataInputStream dis, int length)
          Write (either create or replace) a text file on the local machine with one read from the server.
 

Method Detail

transmitTextFile

void transmitTextFile(java.io.File file,
                      LoggedDataOutputStream dos)
                      throws java.io.IOException
Transmit a text file to the server, using the standard CVS protocol conventions. CR/LFs are converted to the Unix format.

Parameters:
file - the file to transmit
dos - the data outputstream on which to transmit the file
Throws:
java.io.IOException

transmitBinaryFile

void transmitBinaryFile(java.io.File file,
                        LoggedDataOutputStream dos)
                        throws java.io.IOException
Transmit a binary file to the server, using the standard CVS protocol conventions.

Parameters:
file - the file to transmit
dos - the data outputstream on which to transmit the file
Throws:
java.io.IOException

writeTextFile

void writeTextFile(java.lang.String path,
                   java.lang.String mode,
                   LoggedDataInputStream dis,
                   int length)
                   throws java.io.IOException
Write (either create or replace) a text file on the local machine with one read from the server.

Parameters:
path - the absolute path of the file, (including the file name).
mode - the mode of the file
dis - the stream to read the file from, as bytes
length - the number of bytes to read
Throws:
java.io.IOException

writeRcsDiffFile

void writeRcsDiffFile(java.lang.String path,
                      java.lang.String mode,
                      LoggedDataInputStream dis,
                      int length)
                      throws java.io.IOException
Merge a text file on the local machine with the diff from the server. (it uses the RcsDiff response format - see cvsclient.ps for details)

Parameters:
path - the absolute path of the file, (including the file name).
mode - the mode of the file
dis - the stream to read the file from, as bytes
length - the number of bytes to read
Throws:
java.io.IOException

writeBinaryFile

void writeBinaryFile(java.lang.String path,
                     java.lang.String mode,
                     LoggedDataInputStream dis,
                     int length)
                     throws java.io.IOException
Write (either create or replace) a text file on the local machine with one read from the server.

Parameters:
path - the absolute path of the file, (including the file name).
mode - the mode of the file
dis - the stream to read the file from, as bytes
length - the number of bytes to read
Throws:
java.io.IOException

removeLocalFile

void removeLocalFile(java.lang.String pathname)
                     throws java.io.IOException
Remove the specified file from the local disk. If the file does not exist, the operation does nothing.

Parameters:
pathname - the full path to the file to remove
Throws:
java.io.IOException - if an IO error occurs while removing the file

renameLocalFile

void renameLocalFile(java.lang.String pathname,
                     java.lang.String newName)
                     throws java.io.IOException
Rename the local file If the destination file exists, the operation does nothing.

Parameters:
pathname - the full path to the file to rename
newName - the new name of the file (not the full path)
Throws:
java.io.IOException - if an IO error occurs while renaming the file

setNextFileDate

void setNextFileDate(java.util.Date modifiedDate)
Set the modified date of the next file to be written. The next call to writeFile will use this date.

Parameters:
modifiedDate - the date the file should be marked as modified

getInitialisationRequests

Request[] getInitialisationRequests()
Get any requests that must be sent before commands are sent, to init this file handler.

Returns:
an array of Requests that must be sent

setGlobalOptions

void setGlobalOptions(GlobalOptions globalOptions)
Sets the global options. This can be useful to detect, whether local files should be made read-only.


 

Built on August 7 2008.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.