1 17 package org.alfresco.filesys.smb.server.ntfs; 18 19 24 public class StreamInfo 25 { 26 27 29 public static final String StreamSeparator = ":"; 30 31 33 public static final int SetStreamSize = 0x0001; 34 public static final int SetAllocationSize = 0x0002; 35 public static final int SetModifyDate = 0x0004; 36 public static final int SetCreationDate = 0x0008; 37 public static final int SetAccessDate = 0x0010; 38 39 41 private String m_path; 42 private String m_name; 43 44 46 private int m_fid; 47 private int m_stid; 48 49 51 private long m_size; 52 private long m_allocSize; 53 54 56 private long m_createDate; 57 private long m_modifyDate; 58 private long m_accessDate; 59 60 62 private int m_setFlags; 63 64 67 public StreamInfo() 68 { 69 } 70 71 76 public StreamInfo(String path) 77 { 78 79 81 parsePath(path); 82 } 83 84 91 public StreamInfo(String name, int fid, int stid) 92 { 93 m_name = name; 94 m_fid = fid; 95 m_stid = stid; 96 } 97 98 107 public StreamInfo(String name, int fid, int stid, long size, long alloc) 108 { 109 m_name = name; 110 m_fid = fid; 111 m_stid = stid; 112 m_size = size; 113 m_allocSize = alloc; 114 } 115 116 121 public final String getPath() 122 { 123 return m_path; 124 } 125 126 131 public final String getName() 132 { 133 return m_name; 134 } 135 136 141 public final int getFileId() 142 { 143 return m_fid; 144 } 145 146 151 public final int getStreamId() 152 { 153 return m_stid; 154 } 155 156 161 public long getAccessDateTime() 162 { 163 return m_accessDate; 164 } 165 166 171 public long getCreationDateTime() 172 { 173 return m_createDate; 174 } 175 176 181 public final long getModifyDateTime() 182 { 183 return m_modifyDate; 184 } 185 186 191 public final long getSize() 192 { 193 return m_size; 194 } 195 196 201 public final long getAllocationSize() 202 { 203 return m_allocSize; 204 } 205 206 211 public boolean hasAccessDateTime() 212 { 213 return m_accessDate == 0L ? false : true; 214 } 215 216 221 public boolean hasCreationDateTime() 222 { 223 return m_createDate == 0L ? false : true; 224 } 225 226 231 public boolean hasModifyDateTime() 232 { 233 return m_modifyDate == 0L ? false : true; 234 } 235 236 242 public final boolean hasSetFlag(int flag) 243 { 244 if ((m_setFlags & flag) != 0) 245 return true; 246 return false; 247 } 248 249 254 public final int getSetStreamInformationFlags() 255 { 256 return m_setFlags; 257 } 258 259 265 public final void setPath(String path) 266 { 267 parsePath(path); 268 } 269 270 275 public final void setName(String name) 276 { 277 m_name = name; 278 } 279 280 285 public void setAccessDateTime(long timesec) 286 { 287 288 290 m_accessDate = timesec; 291 } 292 293 298 public void setCreationDateTime(long timesec) 299 { 300 301 303 m_createDate = timesec; 304 } 305 306 311 public void setModifyDateTime(long timesec) 312 { 313 314 316 m_modifyDate = timesec; 317 } 318 319 324 public final void setFileId(int id) 325 { 326 m_fid = id; 327 } 328 329 334 public final void setStreamId(int id) 335 { 336 m_stid = id; 337 } 338 339 344 public final void setSize(long size) 345 { 346 m_size = size; 347 } 348 349 354 public final void setAllocationSize(long alloc) 355 { 356 m_allocSize = alloc; 357 } 358 359 364 public final void setStreamInformationFlags(int setFlags) 365 { 366 m_setFlags = setFlags; 367 } 368 369 374 protected final void parsePath(String path) 375 { 376 377 379 int pos = path.indexOf(StreamSeparator); 380 if (pos == -1) 381 { 382 m_path = path; 383 return; 384 } 385 386 388 m_path = path.substring(0, pos); 389 m_name = path.substring(pos + 1); 390 } 391 392 397 public String toString() 398 { 399 StringBuffer str = new StringBuffer (); 400 401 str.append("["); 402 str.append(getName()); 403 str.append(","); 404 str.append(getFileId()); 405 str.append(":"); 406 str.append(getStreamId()); 407 str.append(","); 408 str.append(getSize()); 409 str.append("/"); 410 str.append(getAllocationSize()); 411 str.append("]"); 412 413 return str.toString(); 414 } 415 } 416 | Popular Tags |