1 18 19 package org.apache.tools.zip; 20 21 29 public class UnrecognizedExtraField implements ZipExtraField { 30 31 36 private ZipShort headerId; 37 38 42 public void setHeaderId(ZipShort headerId) { 43 this.headerId = headerId; 44 } 45 46 50 public ZipShort getHeaderId() { 51 return headerId; 52 } 53 54 60 private byte[] localData; 61 62 67 public void setLocalFileDataData(byte[] data) { 68 localData = data; 69 } 70 71 75 public ZipShort getLocalFileDataLength() { 76 return new ZipShort(localData.length); 77 } 78 79 83 public byte[] getLocalFileDataData() { 84 return localData; 85 } 86 87 93 private byte[] centralData; 94 95 99 public void setCentralDirectoryData(byte[] data) { 100 centralData = data; 101 } 102 103 108 public ZipShort getCentralDirectoryLength() { 109 if (centralData != null) { 110 return new ZipShort(centralData.length); 111 } 112 return getLocalFileDataLength(); 113 } 114 115 119 public byte[] getCentralDirectoryData() { 120 if (centralData != null) { 121 return centralData; 122 } 123 return getLocalFileDataData(); 124 } 125 126 132 public void parseFromLocalFileData(byte[] data, int offset, int length) { 133 byte[] tmp = new byte[length]; 134 System.arraycopy(data, offset, tmp, 0, length); 135 setLocalFileDataData(tmp); 136 } 137 } 138 | Popular Tags |