TagData getDataTag() throws IOException { if (dataTag == null) { dataTag = (TagData) tagMap.get(tagid(data_ref, TagEnum.COMPRESSED.getCode())); if (dataTag == null) throw new IllegalStateException("TagCompress not found for " + detail()); dataTag.used = true; } return dataTag; }
public ByteBuffer getByteBuffer() throws IOException { if (bb == null) { H4header.TagData cdata = compress.getDataTag(); InputStream in;
public ByteBuffer getByteBuffer() throws IOException { if (bb == null) { H4header.TagData cdata = compress.getDataTag(); InputStream in;
private void readChunk() throws IOException { H4header.DataChunk chunk = chunks.get(chunkNo); H4header.TagData chunkData = chunk.data; chunkNo++; if (chunkData.ext_type == TagEnum.SPECIAL_COMP) { // read compressed data in H4header.TagData cdata = chunkData.compress.getDataTag(); byte[] cbuffer = new byte[cdata.length]; raf.seek(cdata.offset); raf.readFully(cbuffer); // System.out.println(" read compress " + cdata.length + " at= " + cdata.offset); // uncompress it if (chunkData.compress.compress_type == TagEnum.COMP_CODE_DEFLATE) { InputStream in = new java.util.zip.InflaterInputStream(new ByteArrayInputStream(cbuffer)); ByteArrayOutputStream out = new ByteArrayOutputStream(chunkData.compress.uncomp_length); IO.copy(in, out); buffer = out.toByteArray(); //System.out.println(" uncompress "+buffer.length + ", wanted="+chunkData.compress.uncomp_length); } else { throw new IllegalStateException("unknown compression type =" + chunkData.compress.compress_type); } } else { buffer = new byte[chunkData.length]; raf.seek(chunkData.offset); raf.readFully(buffer); } segPos = 0; segSize = buffer.length; }
private void readChunk() throws IOException { H4header.DataChunk chunk = chunks.get(chunkNo); H4header.TagData chunkData = chunk.data; chunkNo++; if (chunkData.ext_type == TagEnum.SPECIAL_COMP) { // read compressed data in H4header.TagData cdata = chunkData.compress.getDataTag(); byte[] cbuffer = new byte[cdata.length]; raf.seek(cdata.offset); raf.readFully(cbuffer); // System.out.println(" read compress " + cdata.length + " at= " + cdata.offset); // uncompress it if (chunkData.compress.compress_type == TagEnum.COMP_CODE_DEFLATE) { InputStream in = new java.util.zip.InflaterInputStream(new ByteArrayInputStream(cbuffer)); ByteArrayOutputStream out = new ByteArrayOutputStream(chunkData.compress.uncomp_length); IO.copy(in, out); buffer = out.toByteArray(); //System.out.println(" uncompress "+buffer.length + ", wanted="+chunkData.compress.uncomp_length); } else { throw new IllegalStateException("unknown compression type =" + chunkData.compress.compress_type); } } else { buffer = new byte[chunkData.length]; raf.seek(chunkData.offset); raf.readFully(buffer); } segPos = 0; segSize = buffer.length; }
private void readChunk() throws IOException { H4header.DataChunk chunk = chunks.get(chunkNo); H4header.TagData chunkData = chunk.data; chunkNo++; if (chunkData.ext_type == TagEnum.SPECIAL_COMP) { // read compressed data in H4header.TagData cdata = chunkData.compress.getDataTag(); byte[] cbuffer = new byte[cdata.length]; raf.seek(cdata.offset); raf.readFully(cbuffer); // System.out.println(" read compress " + cdata.length + " at= " + cdata.offset); // uncompress it if (chunkData.compress.compress_type == TagEnum.COMP_CODE_DEFLATE) { InputStream in = new java.util.zip.InflaterInputStream(new ByteArrayInputStream(cbuffer)); ByteArrayOutputStream out = new ByteArrayOutputStream(chunkData.compress.uncomp_length); IO.copy(in, out); buffer = out.toByteArray(); //System.out.println(" uncompress "+buffer.length + ", wanted="+chunkData.compress.uncomp_length); } else { throw new IllegalStateException("unknown compression type =" + chunkData.compress.compress_type); } } else { buffer = new byte[chunkData.length]; raf.seek(chunkData.offset); raf.readFully(buffer); } segPos = 0; segSize = buffer.length; }
public ByteBuffer getByteBuffer() throws IOException { if (bb == null) { H4header.TagData cdata = compress.getDataTag(); InputStream in;
void setLayoutInfo() throws IOException { if (data == null) return; if (null != data.linked) { isLinked = true; setDataBlocks(data.linked.getLinkedDataBlocks(), elemSize); } else if (null != data.compress) { isCompressed = true; TagData compData = data.compress.getDataTag(); tags.add(compData); isLinked = (compData.linked != null); if (isLinked) setDataBlocks(compData.linked.getLinkedDataBlocks(), elemSize); else { start = compData.offset; length = compData.length; hasNoData = (start < 0) || (length < 0); } } else if (null != data.chunked) { isChunked = true; chunks = data.chunked.getDataChunks(); chunkSize = data.chunked.chunk_length; isCompressed = data.chunked.isCompressed; } else { start = data.offset; hasNoData = (start < 0); } }
void setLayoutInfo() throws IOException { if (data == null) return; if (null != data.linked) { isLinked = true; setDataBlocks(data.linked.getLinkedDataBlocks(), elemSize); } else if (null != data.compress) { isCompressed = true; TagData compData = data.compress.getDataTag(); tags.add(compData); isLinked = (compData.linked != null); if (isLinked) setDataBlocks(compData.linked.getLinkedDataBlocks(), elemSize); else { start = compData.offset; length = compData.length; hasNoData = (start < 0) || (length < 0); } } else if (null != data.chunked) { isChunked = true; chunks = data.chunked.getDataChunks(); chunkSize = data.chunked.chunk_length; isCompressed = data.chunked.isCompressed; } else { start = data.offset; hasNoData = (start < 0); } }
void setLayoutInfo() throws IOException { if (data == null) return; if (null != data.linked) { isLinked = true; setDataBlocks(data.linked.getLinkedDataBlocks(), elemSize); } else if (null != data.compress) { isCompressed = true; TagData compData = data.compress.getDataTag(); tags.add(compData); isLinked = (compData.linked != null); if (isLinked) setDataBlocks(compData.linked.getLinkedDataBlocks(), elemSize); else { start = compData.offset; length = compData.length; hasNoData = (start < 0) || (length < 0); } } else if (null != data.chunked) { isChunked = true; chunks = data.chunked.getDataChunks(); chunkSize = data.chunked.chunk_length; isCompressed = data.chunked.isCompressed; } else { start = data.offset; hasNoData = (start < 0); } }
protected void read() throws IOException { if (extended) { raf.seek(offset); ext_type = raf.readShort(); // note size wrong in doc if (ext_type == TagEnum.SPECIAL_LINKED) { linked = new SpecialLinked(); linked.read(); } else if (ext_type == TagEnum.SPECIAL_COMP) { compress = new SpecialComp(); compress.read(); } else if (ext_type == TagEnum.SPECIAL_CHUNKED) { chunked = new SpecialChunked(); chunked.read(); } tag_len = (int) (raf.getFilePointer() - offset); } }
void read() throws IOException { if (extended) { raf.seek(offset); ext_type = raf.readShort(); // note size wrong in doc if (ext_type == TagEnum.SPECIAL_LINKED) { linked = new SpecialLinked(); linked.read(); } else if (ext_type == TagEnum.SPECIAL_COMP) { compress = new SpecialComp(); compress.read(); } else if (ext_type == TagEnum.SPECIAL_CHUNKED) { chunked = new SpecialChunked(); chunked.read(); } tag_len = (int) (raf.getFilePointer() - offset); } }
void read() throws IOException { if (extended) { raf.seek(offset); ext_type = raf.readShort(); // note size wrong in doc if (ext_type == TagEnum.SPECIAL_LINKED) { linked = new SpecialLinked(); linked.read(); } else if (ext_type == TagEnum.SPECIAL_COMP) { compress = new SpecialComp(); compress.read(); } else if (ext_type == TagEnum.SPECIAL_CHUNKED) { chunked = new SpecialChunked(); chunked.read(); } tag_len = (int) (raf.getFilePointer() - offset); } }
TagData getDataTag() throws IOException { if (dataTag == null) { dataTag = (TagData) tagMap.get(tagid(data_ref, TagEnum.COMPRESSED.getCode())); if (dataTag == null) throw new IllegalStateException("TagCompress not found for " + detail()); dataTag.used = true; } return dataTag; }
TagData getDataTag() throws IOException { if (dataTag == null) { dataTag = (TagData) tagMap.get(tagid(data_ref, TagEnum.COMPRESSED.getCode())); if (dataTag == null) throw new IllegalStateException("TagCompress not found for " + detail()); dataTag.used = true; } return dataTag; }
public String detail() { if (linked != null) return super.detail() + " ext_tag= " + ext_type + " tag_len= " + tag_len + " " + linked.detail(); else if (compress != null) return super.detail() + " ext_tag= " + ext_type + " tag_len= " + tag_len + " " + compress.detail(); else if (chunked != null) return super.detail() + " ext_tag= " + ext_type + " tag_len= " + tag_len + " " + chunked.detail(); else return super.detail(); }
public String detail() { if (linked != null) return super.detail() + " ext_tag= " + ext_type + " tag_len= " + tag_len + " " + linked.detail(); else if (compress != null) return super.detail() + " ext_tag= " + ext_type + " tag_len= " + tag_len + " " + compress.detail(); else if (chunked != null) return super.detail() + " ext_tag= " + ext_type + " tag_len= " + tag_len + " " + chunked.detail(); else return super.detail(); }
public String detail() { if (linked != null) return super.detail() + " ext_tag= " + ext_type + " tag_len= " + tag_len + " " + linked.detail(); else if (compress != null) return super.detail() + " ext_tag= " + ext_type + " tag_len= " + tag_len + " " + compress.detail(); else if (chunked != null) return super.detail() + " ext_tag= " + ext_type + " tag_len= " + tag_len + " " + chunked.detail(); else return super.detail(); }