8bd24569014571d7a70bea6fbd730c89034943c4.svn-base 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
  2. // Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
  3. // Decompiler options: packimports(3) fieldsfirst ansi
  4. // Source File Name: Files.java
  5. package com.sinosoft.common.upLoad.util;
  6. import java.io.IOException;
  7. import java.util.*;
  8. // Referenced classes of package com.jspsmart.upload:
  9. // File, SmartUpload
  10. public class Files{
  11. @SuppressWarnings("unused")
  12. private SmartUpload m_parent;
  13. @SuppressWarnings("rawtypes")
  14. private Hashtable m_files;
  15. private int m_counter;
  16. @SuppressWarnings("rawtypes")
  17. Files() {
  18. m_files = new Hashtable();
  19. m_counter = 0;
  20. }
  21. @SuppressWarnings("unchecked")
  22. protected void addFile(File newFile) {
  23. if (newFile == null) {
  24. throw new IllegalArgumentException("newFile cannot be null.");
  25. } else {
  26. m_files.put(new Integer(m_counter), newFile);
  27. m_counter++;
  28. return;
  29. }
  30. }
  31. public File getFile(int index) {
  32. if (index < 0)
  33. throw new IllegalArgumentException("File's index cannot be a negative value (1210).");
  34. File retval = (File) m_files.get(new Integer(index));
  35. if (retval == null)
  36. throw new IllegalArgumentException("Files' name is invalid or does not exist (1205).");
  37. else
  38. return retval;
  39. }
  40. public int getCount() {
  41. return m_counter;
  42. }
  43. public long getSize() throws IOException {
  44. long tmp = 0L;
  45. for (int i = 0; i < m_counter; i++)
  46. tmp += getFile(i).getSize();
  47. return tmp;
  48. }
  49. @SuppressWarnings("rawtypes")
  50. public Collection getCollection() {
  51. return m_files.values();
  52. }
  53. @SuppressWarnings("rawtypes")
  54. public Enumeration getEnumeration() {
  55. return m_files.elements();
  56. }
  57. }