You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Entry.java 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.poifs.filesystem;
  16. /**
  17. * This interface provides access to an object managed by a Filesystem
  18. * instance. Entry objects are further divided into DocumentEntry and
  19. * DirectoryEntry instances.
  20. */
  21. public interface Entry
  22. {
  23. /**
  24. * get the name of the Entry
  25. *
  26. * @return name
  27. */
  28. public String getName();
  29. /**
  30. * is this a DirectoryEntry?
  31. *
  32. * @return true if the Entry is a DirectoryEntry, else false
  33. */
  34. public boolean isDirectoryEntry();
  35. /**
  36. * is this a DocumentEntry?
  37. *
  38. * @return true if the Entry is a DocumentEntry, else false
  39. */
  40. public boolean isDocumentEntry();
  41. /**
  42. * get this Entry's parent (the DirectoryEntry that owns this
  43. * Entry). All Entry objects, except the root Entry, has a parent.
  44. *
  45. * @return this Entry's parent; null iff this is the root Entry
  46. */
  47. public DirectoryEntry getParent();
  48. /**
  49. * Delete this Entry. This operation should succeed, but there are
  50. * special circumstances when it will not:
  51. *
  52. * If this Entry is the root of the Entry tree, it cannot be
  53. * deleted, as there is no way to create another one.
  54. *
  55. * If this Entry is a directory, it cannot be deleted unless it is
  56. * empty.
  57. *
  58. * @return true if the Entry was successfully deleted, else false
  59. */
  60. public boolean delete();
  61. /**
  62. * Rename this Entry. This operation will fail if:
  63. *
  64. * There is a sibling Entry (i.e., an Entry whose parent is the
  65. * same as this Entry's parent) with the same name.
  66. *
  67. * This Entry is the root of the Entry tree. Its name is dictated
  68. * by the Filesystem and many not be changed.
  69. *
  70. * @param newName the new name for this Entry
  71. *
  72. * @return true if the operation succeeded, else false
  73. */
  74. public boolean renameTo(final String newName);
  75. } // end public interface Entry