Class RpcPerforceFile

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<java.io.File>

    public class RpcPerforceFile
    extends java.io.File
    Encapsulates and implements a lot of Perforce-specific information and operations on Perforce client-side files by extending the basic java.io.File class with Perforce-specific fields and methods.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String systemTmpDirName  
      static java.lang.String TMP_FILE_PFX  
      static java.lang.String TMP_FILE_SFX  
      static java.lang.String TRACE_PREFIX  
      • Fields inherited from class java.io.File

        pathSeparator, pathSeparatorChar, separator, separatorChar
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canCopyAsIs()
      True IFF we should be able to copy this file as-is, i.e.
      boolean copyTo​(java.io.File targetFile)
      Copy this file to another (target file).
      static java.lang.String createTempFileName​(java.lang.String tmpDirName)  
      boolean decodeTo​(java.io.File targetFile)  
      boolean equals​(java.lang.Object obj)  
      static boolean fileExists​(java.io.File file, boolean fstSymlink)
      Check if the file or symbolic link exists.
      RpcPerforceFileType getFileType()  
      ClientLineEnding getLineEnding()  
      int hashCode()  
      boolean isSymlink()  
      boolean renameTo​(java.io.File targetFile)
      Our "special" version of rename, intended to cope with the cases when the normal rename won't work (typically cross-device renames) or when we need to do some under-the-covers stitching up (for example, GKZIP stream decoding).
      boolean renameTo​(java.io.File targetFile, boolean alwaysCopyUnMunged)
      Another special version of renameTo to support RPC implementation- specific needs.
      void setFileType​(RpcPerforceFileType fileType)  
      void setLineEnding​(ClientLineEnding lineEnding)  
      • Methods inherited from class java.io.File

        canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getFreeSpace, getName, getParent, getParentFile, getPath, getTotalSpace, getUsableSpace, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toString, toURI, toURL
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • TRACE_PREFIX

        public static java.lang.String TRACE_PREFIX
      • systemTmpDirName

        public static java.lang.String systemTmpDirName
    • Constructor Detail

      • RpcPerforceFile

        public RpcPerforceFile​(java.lang.String fileName,
                               java.lang.String fileTypeStr)
      • RpcPerforceFile

        public RpcPerforceFile​(java.lang.String fileName,
                               RpcPerforceFileType fileType)
    • Method Detail

      • createTempFileName

        public static java.lang.String createTempFileName​(java.lang.String tmpDirName)
      • renameTo

        public boolean renameTo​(java.io.File targetFile)
        Our "special" version of rename, intended to cope with the cases when the normal rename won't work (typically cross-device renames) or when we need to do some under-the-covers stitching up (for example, GKZIP stream decoding).
        Overrides:
        renameTo in class java.io.File
      • renameTo

        public boolean renameTo​(java.io.File targetFile,
                                boolean alwaysCopyUnMunged)
        Another special version of renameTo to support RPC implementation- specific needs. This one allows callers to specify whether to always copy as-is (no munging).
        Parameters:
        targetFile - targetFile
        alwaysCopyUnMunged - alwaysCopyUnMunged
        Returns:
        ok
      • copyTo

        public boolean copyTo​(java.io.File targetFile)
                       throws java.io.IOException
        Copy this file to another (target file). Assumes no decoding necessary. If the target file exists, it's removed before copying.
        Parameters:
        targetFile - targetFile
        Returns:
        ok
        Throws:
        java.io.IOException - on error
      • decodeTo

        public boolean decodeTo​(java.io.File targetFile)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • canCopyAsIs

        public boolean canCopyAsIs()
        True IFF we should be able to copy this file as-is, i.e. without GKZIP decoding or munging, etc. Currently all file types can be copied as-is, but this wasn't always true and may not always be true...
        Returns:
        ok
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.io.File
        See Also:
        File.equals(Object)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.io.File
        See Also:
        File.hashCode()
      • isSymlink

        public boolean isSymlink()
      • fileExists

        public static boolean fileExists​(java.io.File file,
                                         boolean fstSymlink)
        Check if the file or symbolic link exists.
        Parameters:
        file - file
        fstSymlink - fstSymlink
        Returns:
        exists