Java Code Examples for io.netty.buffer.ByteBuf.writableBytes()

The following are Jave code examples for showing how to use writableBytes() of the io.netty.buffer.ByteBuf class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: NettyStudy   File: ByteBufExamples.java   Source Code and License Vote up 4 votes
/**
 * Listing 5.8
 */
public static void write(ByteBuf buffer) {
    while (buffer.writableBytes() >= 4) {
        buffer.writeInt(random.nextInt());
    }
}