Search in sources :

Example 1 with ChunkStream

use of org.apache.poi.hdgf.streams.ChunkStream in project poi by apache.

the class VSDDumper method dumpStream.

private void dumpStream(Stream stream, int indent) {
    Pointer ptr = stream.getPointer();
    dumpVal("Stream at", ptr.getOffset(), indent);
    dumpVal("Type is", ptr.getType(), indent + 1);
    dumpVal("Format is", ptr.getFormat(), indent + 1);
    dumpVal("Length is", ptr.getLength(), indent + 1);
    if (ptr.destinationCompressed()) {
        dumpVal("DC.Length is", stream._getContentsLength(), indent + 1);
    }
    dumpVal("Compressed is", ptr.destinationCompressed(), indent + 1);
    dumpVal("Stream is", stream.getClass().getName(), indent + 1);
    byte[] db = stream._getStore()._getContents();
    String ds = (db.length >= 8) ? Arrays.toString(db) : "[]";
    dumpVal("First few bytes are", ds, indent + 1);
    if (stream instanceof PointerContainingStream) {
        Stream[] streams = ((PointerContainingStream) stream).getPointedToStreams();
        dumpVal("Nbr of children", streams.length, indent + 1);
        for (Stream s : streams) {
            dumpStream(s, indent + 1);
        }
    }
    if (stream instanceof ChunkStream) {
        Chunk[] chunks = ((ChunkStream) stream).getChunks();
        dumpVal("Nbr of chunks", chunks.length, indent + 1);
        for (Chunk chunk : chunks) {
            dumpChunk(chunk, indent + 1);
        }
    }
}
Also used : ChunkStream(org.apache.poi.hdgf.streams.ChunkStream) Pointer(org.apache.poi.hdgf.pointers.Pointer) PrintStream(java.io.PrintStream) PointerContainingStream(org.apache.poi.hdgf.streams.PointerContainingStream) ChunkStream(org.apache.poi.hdgf.streams.ChunkStream) Stream(org.apache.poi.hdgf.streams.Stream) PointerContainingStream(org.apache.poi.hdgf.streams.PointerContainingStream) Chunk(org.apache.poi.hdgf.chunks.Chunk)

Aggregations

PrintStream (java.io.PrintStream)1 Chunk (org.apache.poi.hdgf.chunks.Chunk)1 Pointer (org.apache.poi.hdgf.pointers.Pointer)1 ChunkStream (org.apache.poi.hdgf.streams.ChunkStream)1 PointerContainingStream (org.apache.poi.hdgf.streams.PointerContainingStream)1 Stream (org.apache.poi.hdgf.streams.Stream)1