1 17 package org.alfresco.filesys.server.filesys; 18 19 import org.alfresco.filesys.smb.PCShare; 20 21 26 public class DiskInfo 27 { 28 29 31 protected String m_nodename; 32 protected String m_share; 33 34 36 protected long m_totalunits; 37 protected long m_freeunits; 38 39 41 protected long m_blockperunit; 42 protected long m_blocksize; 43 44 47 public DiskInfo() 48 { 49 } 50 51 60 public DiskInfo(PCShare shr, int totunits, int blkunit, int blksiz, int freeunit) 61 { 62 if (shr != null) 63 { 64 m_nodename = shr.getNodeName(); 65 m_share = shr.getShareName(); 66 } 67 68 m_totalunits = (long) totunits; 69 m_freeunits = (long) freeunit; 70 71 m_blockperunit = (long) blkunit; 72 m_blocksize = (long) blksiz; 73 } 74 75 84 public DiskInfo(PCShare shr, long totunits, int blkunit, int blksiz, long freeunit) 85 { 86 if (shr != null) 87 { 88 m_nodename = shr.getNodeName(); 89 m_share = shr.getShareName(); 90 } 91 92 m_totalunits = totunits; 93 m_freeunits = freeunit; 94 95 m_blockperunit = (long) blkunit; 96 m_blocksize = (long) blksiz; 97 } 98 99 104 public final int getBlockSize() 105 { 106 return (int) m_blocksize; 107 } 108 109 114 public final int getBlocksPerAllocationUnit() 115 { 116 return (int) m_blockperunit; 117 } 118 119 124 public final long getDiskFreeSizeKb() 125 { 126 return (((m_freeunits * m_blockperunit) * m_blocksize) / 1024L); 127 } 128 129 134 public final long getDiskFreeSizeMb() 135 { 136 return getDiskFreeSizeKb() / 1024L; 137 } 138 139 144 public final long getDiskSizeKb() 145 { 146 return (((m_totalunits * m_blockperunit) * m_blocksize) / 1024L); 147 } 148 149 154 public final long getDiskSizeMb() 155 { 156 return (getDiskSizeKb() / 1024L); 157 } 158 159 164 public final long getFreeUnits() 165 { 166 return m_freeunits; 167 } 168 169 174 public final long getUnitSize() 175 { 176 return m_blockperunit * m_blocksize; 177 } 178 179 184 public final String getNodeName() 185 { 186 return m_nodename; 187 } 188 189 194 public final String getShareName() 195 { 196 return m_share; 197 } 198 199 204 public final long getTotalUnits() 205 { 206 return m_totalunits; 207 } 208 209 214 public String toString() 215 { 216 StringBuffer str = new StringBuffer (); 217 218 str.append("["); 219 str.append(getTotalUnits()); 220 str.append("/"); 221 str.append(getFreeUnits()); 222 str.append(","); 223 str.append(getBlockSize()); 224 str.append("/"); 225 str.append(getBlocksPerAllocationUnit()); 226 227 str.append(","); 228 str.append(getDiskSizeMb()); 229 str.append("Mb/"); 230 str.append(getDiskFreeSizeMb()); 231 str.append("Mb"); 232 233 str.append("]"); 234 235 return str.toString(); 236 } 237 } | Popular Tags |