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

com.fireflysource.net.websocket.common.frame.ReadOnlyDelegatedFrame Maven / Gradle / Ivy

There is a newer version: 5.0.2
Show newest version
package com.fireflysource.net.websocket.common.frame;

import java.nio.ByteBuffer;

/**
 * Immutable, Read-only, Frame implementation.
 */
public class ReadOnlyDelegatedFrame implements Frame {
    private final Frame delegate;

    public ReadOnlyDelegatedFrame(Frame frame) {
        this.delegate = frame;
    }

    @Override
    public byte[] getMask() {
        return delegate.getMask();
    }

    @Override
    public byte getOpCode() {
        return delegate.getOpCode();
    }

    @Override
    public ByteBuffer getPayload() {
        if (!delegate.hasPayload()) {
            return null;
        }
        return delegate.getPayload().asReadOnlyBuffer();
    }

    @Override
    public int getPayloadLength() {
        return delegate.getPayloadLength();
    }

    @Override
    public Type getType() {
        return delegate.getType();
    }

    @Override
    public boolean hasPayload() {
        return delegate.hasPayload();
    }

    @Override
    public boolean isFin() {
        return delegate.isFin();
    }

    @Override
    public boolean isMasked() {
        return delegate.isMasked();
    }

    @Override
    public boolean isRsv1() {
        return delegate.isRsv1();
    }

    @Override
    public boolean isRsv2() {
        return delegate.isRsv2();
    }

    @Override
    public boolean isRsv3() {
        return delegate.isRsv3();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy