1 17 package org.alfresco.filesys.server.filesys; 18 19 23 public final class FileAction 24 { 25 27 public static final int FailIfExists = 0x0000; 28 public static final int OpenIfExists = 0x0001; 29 public static final int TruncateExisting = 0x0002; 30 public static final int CreateNotExist = 0x0010; 31 32 34 public static final int FileExisted = 0x0001; 35 public static final int FileCreated = 0x0002; 36 public static final int FileTruncated = 0x0003; 37 38 40 public final static int NTSupersede = 0; public final static int NTOpen = 1; public final static int NTCreate = 2; public final static int NTOpenIf = 3; public final static int NTOverwrite = 4; public final static int NTOverwriteIf = 5; 47 54 public final static boolean createNotExists(int action) 55 { 56 if ((action & CreateNotExist) != 0) 57 return true; 58 return false; 59 } 60 61 67 public final static boolean openIfExists(int action) 68 { 69 if ((action & OpenIfExists) != 0) 70 return true; 71 return false; 72 } 73 74 80 public final static boolean truncateExistingFile(int action) 81 { 82 if ((action & TruncateExisting) != 0) 83 return true; 84 return false; 85 } 86 87 93 public final static String asString(int flags) 94 { 95 StringBuffer str = new StringBuffer (); 96 97 str.append("[0x"); 98 str.append(Integer.toHexString(flags)); 99 str.append(":"); 100 101 if (openIfExists(flags)) 102 str.append("OpenExists|"); 103 104 if (truncateExistingFile(flags)) 105 str.append("Truncate|"); 106 107 if (createNotExists(flags)) 108 str.append("CreateNotExist"); 109 110 str.append("]"); 111 112 return str.toString(); 113 } 114 } | Popular Tags |