|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<RpcPerforceFileType> com.perforce.p4java.impl.mapbased.rpc.sys.RpcPerforceFileType
public enum RpcPerforceFileType
Definitions for Perforce client and server file types.
Perforce defines a surprising variety of basic file types and associated modifiers that determine things like how to send and receive file contents between the client and the server (UTF-8 vs UTF-16, compressed binary vs. uncompressed binary, plain old "text", etc.) and how to interpret file metadata. These types and the associated panoply of methods, etc., are mostly used in the clientCheckFile, clientOpen, clientClose, clientWrite, etc. methods on the various client function classes.
A file's type is stored in the server for all known files, (see e.g. "p4 help filemap" and "p4 help filetypes"), and in most cases we simply accept what we're given if we can cope with that type (there are some types we don't process at all here -- see below). What sort of file types a server (as opposed to the client) knows about and can process depends on the server's xlevel protocol variable:
- xfiles unset: return text, binary. - xfiles >= 0: also return xtext, xbinary. - xfiles >= 1: also return symlink. - xfiles >= 2; also return resource (mac resource file). - xfiles >= 3; also return ubinary - xfiles >= 4; also return appleIn general, the client has to honour the server's xlevel capabilities, so the client may have to do a bit of work to get things right here. Unfortunately, in some cases it's very difficult to know what Perforce type a file should be, and there's a bunch of digging around that must be done to intuit the proper type for files the server doesn't (yet) know about.
Also somewhat unfortunately, the file type is encoded quite differently depending on whether it's coming from the server (usually encoded as a string representation of hex numbers) or going to the server (where it's usually done as plain old "text" or "ubinary", etc.).
Nested Class Summary | |
---|---|
static class |
RpcPerforceFileType.RpcServerTypeStringSpec
|
Field Summary | |
---|---|
static String |
TRACE_PREFIX
|
Method Summary | |
---|---|
static RpcPerforceFileType |
decodeFromServerString(String str)
Decode the file type from the string sent by the server. |
static RpcPerforceFileType.RpcServerTypeStringSpec |
getServerFileTypeString(String clientPath,
RpcPerforceFileType fileType,
String forceType,
int xfiles)
Given a Perforce file type and the Perforce server's xfiles level (from the protocol parameters), determine what server file type to send to the server to represent the passed-in file type as a string, and / or what error or info message to send to the user. |
static RpcPerforceFileType |
inferFileType(File file,
boolean isUnicodeServer,
Charset clientCharset)
Infer (or even intuit) the Perforce file type of the passed-in Perforce file. |
boolean |
isExecutable()
Checking for executable file types - excluding "forbidden" types. |
static boolean |
isProbablySymLink(File file)
Return true if there's some reason to believe this file is a Unix or Linux symbolic link. |
static RpcPerforceFileType |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static RpcPerforceFileType[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final RpcPerforceFileType FST_TEXT
public static final RpcPerforceFileType FST_BINARY
public static final RpcPerforceFileType FST_GZIP
public static final RpcPerforceFileType FST_DIRECTORY
public static final RpcPerforceFileType FST_SYMLINK
public static final RpcPerforceFileType FST_RESOURCE
public static final RpcPerforceFileType FST_SPECIAL
public static final RpcPerforceFileType FST_MISSING
public static final RpcPerforceFileType FST_CANTTELL
public static final RpcPerforceFileType FST_EMPTY
public static final RpcPerforceFileType FST_UNICODE
public static final RpcPerforceFileType FST_GUNZIP
public static final RpcPerforceFileType FST_UTF16
public static final RpcPerforceFileType FST_ATEXT
public static final RpcPerforceFileType FST_XTEXT
public static final RpcPerforceFileType FST_RTEXT
public static final RpcPerforceFileType FST_RXTEXT
public static final RpcPerforceFileType FST_CBINARY
public static final RpcPerforceFileType FST_XBINARY
public static final RpcPerforceFileType FST_XSYMLINK
public static final RpcPerforceFileType FST_XRESOURCE
public static final RpcPerforceFileType FST_APPLETEXT
public static final RpcPerforceFileType FST_APPLEFILE
public static final RpcPerforceFileType FST_XAPPLEFILE
public static final RpcPerforceFileType FST_XAPPLETEXT
public static final RpcPerforceFileType FST_XUNICODE
public static final RpcPerforceFileType FST_XRTEXT
public static final RpcPerforceFileType FST_XUTF16
public static final RpcPerforceFileType FST_XGUNZIP
public static final RpcPerforceFileType FST_RCS
Field Detail |
---|
public static final String TRACE_PREFIX
Method Detail |
---|
public static RpcPerforceFileType[] values()
for (RpcPerforceFileType c : RpcPerforceFileType.values()) System.out.println(c);
public static RpcPerforceFileType valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic static RpcPerforceFileType decodeFromServerString(String str)
public boolean isExecutable()
public static RpcPerforceFileType inferFileType(File file, boolean isUnicodeServer, Charset clientCharset)
Note that Java does not allow us to directly access most file metadata. This probably doesn't matter in most cases, but we do need to keep an eye on this -- HR.
public static RpcPerforceFileType.RpcServerTypeStringSpec getServerFileTypeString(String clientPath, RpcPerforceFileType fileType, String forceType, int xfiles)
public static boolean isProbablySymLink(File file)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |