1 17 18 package net.sourceforge.groboutils.codecoverage.v2.ant.zip; 19 20 30 public class UnrecognizedExtraField implements ZipExtraField { 31 32 37 private ZipShort headerId; 38 39 public void setHeaderId(ZipShort headerId) { 40 this.headerId = headerId; 41 } 42 43 public ZipShort getHeaderId() { 44 return headerId; 45 } 46 47 53 private byte[] localData; 54 55 public void setLocalFileDataData(byte[] data) { 56 localData = data; 57 } 58 59 public ZipShort getLocalFileDataLength() { 60 return new ZipShort(localData.length); 61 } 62 63 public byte[] getLocalFileDataData() { 64 return localData; 65 } 66 67 73 private byte[] centralData; 74 75 public void setCentralDirectoryData(byte[] data) { 76 centralData = data; 77 } 78 79 public ZipShort getCentralDirectoryLength() { 80 if (centralData != null) { 81 return new ZipShort(centralData.length); 82 } 83 return getLocalFileDataLength(); 84 } 85 86 public byte[] getCentralDirectoryData() { 87 if (centralData != null) { 88 return centralData; 89 } 90 return getLocalFileDataData(); 91 } 92 93 public void parseFromLocalFileData(byte[] data, int offset, int length) { 94 byte[] tmp = new byte[length]; 95 System.arraycopy(data, offset, tmp, 0, length); 96 setLocalFileDataData(tmp); 97 } 98 } 99 | Popular Tags |