aeron-samples/src/main/java/io/aeron/samples/archive/SegmentInspector.java
public static void dumpSegment(final PrintStream out, final int messageDumpLimit, final UnsafeBuffer buffer)
    {
        final DataHeaderFlyweight dataHeaderFlyweight = new DataHeaderFlyweight();
        final int length = buffer.capacity();
        int offset = 0;

        while (offset < length)
        {
            dataHeaderFlyweight.wrap(buffer, offset, length - offset);
            out.println(offset + ": " + dataHeaderFlyweight.toString());

            final int frameLength = dataHeaderFlyweight.frameLength();
            if (frameLength < DataHeaderFlyweight.HEADER_LENGTH)
            {
                break;
            }

            final int limit = min(frameLength - HEADER_LENGTH, messageDumpLimit);
            out.println(LogInspector.formatBytes(buffer, offset + HEADER_LENGTH, limit));
            offset += BitUtil.align(frameLength, FrameDescriptor.FRAME_ALIGNMENT);
        }
    }
public static void dumpSegment(final PrintStream out, final int messageDumpLimit, final UnsafeBuffer buffer)
    {
        final DataHeaderFlyweight dataHeaderFlyweight = new DataHeaderFlyweight();
        final int length = buffer.capacity();
        int offset = 0;

        while (offset < length)
        {
            dataHeaderFlyweight.wrap(buffer, offset, length - offset);
            out.println(offset + ": " + dataHeaderFlyweight.toString());

            final int frameLength = dataHeaderFlyweight.frameLength();
            if (frameLength < DataHeaderFlyweight.HEADER_LENGTH)
            {
                break;
            }

            final int limit = min(frameLength - HEADER_LENGTH, messageDumpLimit);
            out.println(LogInspector.formatBytes(buffer, offset + HEADER_LENGTH, limit));
            offset += BitUtil.align(frameLength, FrameDescriptor.FRAME_ALIGNMENT);
        }
    }
public static void dumpSegment ( final PrintStream out , final int messageDumpLimit , final UnsafeBuffer buffer ) { final DataHeaderFlyweight dataHeaderFlyweight = new DataHeaderFlyweight ( ) ; final int length = buffer . capacity ( ) ; int offset = 0 ; while ( offset < length ) { dataHeaderFlyweight . wrap ( buffer , offset , length - offset ) ; out . println ( offset + ": " + dataHeaderFlyweight . toString ( ) ) ; final int frameLength = dataHeaderFlyweight . frameLength ( ) ; if ( frameLength < DataHeaderFlyweight . HEADER_LENGTH ) { break ; } final int limit = min ( frameLength - HEADER_LENGTH , messageDumpLimit ) ; out . println ( LogInspector . formatBytes ( buffer , offset + HEADER_LENGTH , limit ) ) ; offset += BitUtil . align ( frameLength , FrameDescriptor . FRAME_ALIGNMENT ) ; } }
Dump the contents of a segment file to a {@link PrintStream}.

@param out              for the dumped contents.
@param messageDumpLimit for the number of bytes per message fragment to dump.
@param buffer           the wraps the segment file.
Dump the contents of a segment file to a { @link PrintStream } .