1. /*
  2. * Copyright 2001,2004 The Apache Software Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. package org.apache.tools.zip;
  18. import java.util.zip.ZipException;
  19. /**
  20. * General format of extra field data.
  21. *
  22. * <p>Extra fields usually appear twice per file, once in the local
  23. * file data and once in the central directory. Usually they are the
  24. * same, but they don't have to be. {@link
  25. * java.util.zip.ZipOutputStream java.util.zip.ZipOutputStream} will
  26. * only use the local file data in both places.</p>
  27. *
  28. * @version $Revision: 1.5.2.4 $
  29. */
  30. public interface ZipExtraField {
  31. /**
  32. * The Header-ID.
  33. *
  34. * @since 1.1
  35. */
  36. ZipShort getHeaderId();
  37. /**
  38. * Length of the extra field in the local file data - without
  39. * Header-ID or length specifier.
  40. *
  41. * @since 1.1
  42. */
  43. ZipShort getLocalFileDataLength();
  44. /**
  45. * Length of the extra field in the central directory - without
  46. * Header-ID or length specifier.
  47. *
  48. * @since 1.1
  49. */
  50. ZipShort getCentralDirectoryLength();
  51. /**
  52. * The actual data to put into local file data - without Header-ID
  53. * or length specifier.
  54. *
  55. * @since 1.1
  56. */
  57. byte[] getLocalFileDataData();
  58. /**
  59. * The actual data to put central directory - without Header-ID or
  60. * length specifier.
  61. *
  62. * @since 1.1
  63. */
  64. byte[] getCentralDirectoryData();
  65. /**
  66. * Populate data from this array as if it was in local file data.
  67. *
  68. * @since 1.1
  69. */
  70. void parseFromLocalFileData(byte[] data, int offset, int length)
  71. throws ZipException;
  72. }