public static ChannelBuffer streamToChannelBuffer(DbusEventBuffer buf, Checkpoint cp,
int maxSize,
DbusEventsStatisticsCollector stats)
throws ScnNotFoundException, OffsetNotFoundException, IOException
{
ChannelBuffer tmpBuf = ChannelBuffers.buffer(new DbusEventV1Factory().getByteOrder(), maxSize);
OutputStream tmpOS = new ChannelBufferOutputStream(tmpBuf);
WritableByteChannel tmpChannel = java.nio.channels.Channels.newChannel(tmpOS);
StreamEventsArgs args = new StreamEventsArgs(maxSize).setStatsCollector(stats);