1 17 package org.alfresco.filesys.smb; 18 19 import java.util.BitSet ; 20 21 24 public class DialectSelector 25 { 26 27 29 private BitSet dialects; 30 31 34 35 public DialectSelector() 36 { 37 dialects = new BitSet (Dialect.Max); 38 39 41 ClearAll(); 42 AddDialect(Dialect.Core); 43 } 44 45 51 52 public void AddDialect(int d) throws java.lang.ArrayIndexOutOfBoundsException 53 { 54 dialects.set(d); 55 } 56 57 60 61 public void ClearAll() 62 { 63 for (int i = 0; i < dialects.size(); dialects.clear(i++)) 64 ; 65 } 66 67 72 public void copyFrom(DialectSelector dsel) 73 { 74 75 77 ClearAll(); 78 79 81 for (int i = 0; i < Dialect.Max; i++) 82 { 83 84 86 if (dsel.hasDialect(i)) 87 AddDialect(i); 88 } 89 } 90 91 98 99 public boolean hasDialect(int d) throws java.lang.ArrayIndexOutOfBoundsException 100 { 101 return dialects.get(d); 102 } 103 104 109 public boolean hasCore() 110 { 111 if (hasDialect(Dialect.Core) || hasDialect(Dialect.CorePlus)) 112 return true; 113 return false; 114 } 115 116 121 public boolean hasLanMan() 122 { 123 if (hasDialect(Dialect.DOSLanMan1) || hasDialect(Dialect.DOSLanMan2) || hasDialect(Dialect.LanMan1) 124 || hasDialect(Dialect.LanMan2) || hasDialect(Dialect.LanMan2_1)) 125 return true; 126 return false; 127 } 128 129 134 public boolean hasNT() 135 { 136 if (hasDialect(Dialect.NT)) 137 return true; 138 return false; 139 } 140 141 147 148 public void RemoveDialect(int d) throws java.lang.ArrayIndexOutOfBoundsException 149 { 150 dialects.clear(d); 151 } 152 153 158 public String toString() 159 { 160 161 163 StringBuffer str = new StringBuffer (); 164 str.append("["); 165 166 for (int i = 0; i < dialects.size(); i++) 167 { 168 if (hasDialect(i)) 169 { 170 str.append(Dialect.DialectTypeString(i)); 171 str.append(","); 172 } 173 } 174 175 177 if (str.length() > 1) 178 str.setLength(str.length() - 1); 179 str.append("]"); 180 return str.toString(); 181 } 182 } | Popular Tags |