public void printStreamInfo() throws IOException {
        OggPacketReader r = ogg.getPacketReader();

        System.out.println("Processing file \"" + file.toString() + "\"");

        int pc = 0;
        int streams = 0;
        int lastSid = -1;

        Map<Integer, String> streamTypes = new HashMap<Integer, String>();

        OggPacket p;
        while( (p = r.getNextPacket()) != null ) {
            if(p.isBeginningOfStream()) {
                streams++;
                lastSid = p.getSid();

                System.out.println("");
                System.out.println("New logical stream #"+streams + ", serial: " +
                                   Integer.toHexString(p.getSid()) + " (" + p.getSid() + ")");

                OggStreamType type = OggStreamIdentifier.identifyType(p);
                streamTypes.put(lastSid, type.description);

                System.out.println("\t"+type.description+" detected ("+type.mimetype+")");
            } else if(p.isEndOfStream()) {
                if (pc > 0) {
                    System.out.println("(" + pc + " mid-stream packets of " +
                                       Integer.toHexString(p.getSid()) + ")");
                }
                System.out.println("Stream " + Integer.toHexString(p.getSid()) + 
                                   " of " + streamTypes.get(p.getSid()) + " ended");
                pc = 0;
            } else {
                if(p.getSid() != lastSid) {
                    System.out.println("(" + pc + " packets of stream " +
                                       Integer.toHexString(p.getSid()) + ")");

                    lastSid = p.getSid();
                    pc = 0;
                } else {
                    pc++;
                }
            }
        }
    }