1 17 package org.alfresco.filesys.server.core; 18 19 23 public class ShareType 24 { 25 27 public static final int DISK = 0; 28 29 31 public static final int PRINTER = 1; 32 33 35 public static final int NAMEDPIPE = 2; 36 37 39 public static final int ADMINPIPE = 3; 40 41 43 public static final int UNKNOWN = -1; 44 45 51 public final static int asShareInfoType(int typ) 52 { 53 54 57 int shrTyp = 0; 58 59 switch (typ) 60 { 61 case DISK: 62 shrTyp = 0; 63 break; 64 case PRINTER: 65 shrTyp = 1; 66 break; 67 case NAMEDPIPE: 68 case ADMINPIPE: 69 shrTyp = 3; 70 break; 71 } 72 return shrTyp; 73 } 74 75 81 public final static int ServiceAsType(String srvName) 82 { 83 84 86 if (srvName.compareTo("A:") == 0) 87 return DISK; 88 else if (srvName.compareTo("LPT1:") == 0) 89 return PRINTER; 90 else if (srvName.compareTo("IPC") == 0) 91 return NAMEDPIPE; 92 93 95 return UNKNOWN; 96 } 97 98 104 public final static String TypeAsService(int typ) 105 { 106 107 if (typ == DISK) 108 return "A:"; 109 else if (typ == PRINTER) 110 return "LPT1:"; 111 else if (typ == NAMEDPIPE || typ == ADMINPIPE) 112 return "IPC"; 113 return ""; 114 } 115 116 122 public final static String TypeAsString(int typ) 123 { 124 125 if (typ == DISK) 126 return "DISK"; 127 else if (typ == PRINTER) 128 return "PRINT"; 129 else if (typ == NAMEDPIPE) 130 return "PIPE"; 131 else if (typ == ADMINPIPE) 132 return "IPC$"; 133 return "<Unknown>"; 134 } 135 } | Popular Tags |