Class RpcPerforceFile
- java.lang.Object
-
- java.io.File
-
- com.perforce.p4java.impl.mapbased.rpc.sys.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
-
Constructor Summary
Constructors Constructor Description RpcPerforceFile(java.lang.String fileName, RpcPerforceFileType fileType)
RpcPerforceFile(java.lang.String fileName, RpcPerforceFileType fileType, ClientLineEnding lineEnding)
RpcPerforceFile(java.lang.String fileName, java.lang.String fileTypeStr)
-
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
-
-
-
-
Field Detail
-
TRACE_PREFIX
public static java.lang.String TRACE_PREFIX
-
systemTmpDirName
public static java.lang.String systemTmpDirName
-
TMP_FILE_PFX
public static final java.lang.String TMP_FILE_PFX
- See Also:
- Constant Field Values
-
TMP_FILE_SFX
public static final java.lang.String TMP_FILE_SFX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RpcPerforceFile
public RpcPerforceFile(java.lang.String fileName, java.lang.String fileTypeStr)
-
RpcPerforceFile
public RpcPerforceFile(java.lang.String fileName, RpcPerforceFileType fileType)
-
RpcPerforceFile
public RpcPerforceFile(java.lang.String fileName, RpcPerforceFileType fileType, ClientLineEnding lineEnding)
-
-
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 classjava.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
- targetFilealwaysCopyUnMunged
- 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
-
getFileType
public RpcPerforceFileType getFileType()
-
setFileType
public void setFileType(RpcPerforceFileType fileType)
-
getLineEnding
public ClientLineEnding getLineEnding()
-
setLineEnding
public void setLineEnding(ClientLineEnding lineEnding)
-
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 classjava.io.File
- See Also:
File.equals(Object)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.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
- filefstSymlink
- fstSymlink- Returns:
- exists
-
-