All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.jetty.websocket.RandomMaskGen Maven / Gradle / Ivy

There is a newer version: 11.0.0.beta1
Show newest version
package org.eclipse.jetty.websocket;

import java.util.Random;


public class RandomMaskGen implements MaskGen
{
    private final Random _random;

    public RandomMaskGen()
    {
        this(new Random());
    }

    public RandomMaskGen(Random random)
    {
        _random=random;
    }

    public void genMask(byte[] mask)
    {
        // The assumption is that this code is always called
        // with an external lock held to prevent concurrent access
        // Otherwise we need to synchronize on the _random.
        _random.nextBytes(mask);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy