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

com.webpieces.hpack.impl.MarshalStateImpl Maven / Gradle / Ivy

Go to download

A re-usable asynchronous HTTP/2 parser WITH header serialization/deserialization (hpack)

There is a newer version: 2.1.109
Show newest version
package com.webpieces.hpack.impl;

import java.io.IOException;

import com.twitter.hpack.Encoder;
import com.webpieces.hpack.api.MarshalState;
import org.digitalforge.sneakythrow.SneakyThrow;

public class MarshalStateImpl implements MarshalState {

	private HeaderEncoding encoding;
	private Encoder encoder;
	private volatile long remoteMaxFrameSize;

	public MarshalStateImpl(HeaderEncoding encoding, Encoder encoder, long remoteMaxFrameSize) {
		this.encoding = encoding;
		this.encoder = encoder;
		this.remoteMaxFrameSize = remoteMaxFrameSize;
	}

	public Encoder getEncoder() {
		return encoder;
	}

	public long getMaxRemoteFrameSize() {
		return remoteMaxFrameSize;
	}

	@Override
	public void setOutoingMaxFrameSize(long maxFrameSize) {
		remoteMaxFrameSize = maxFrameSize;
	}
	
	@Override
    public void setOutgoingMaxTableSize(int newSize) {
		try {
			encoding.setMaxHeaderTableSize(encoder, newSize);
		} catch (IOException e) {
			throw SneakyThrow.sneak(e);
		}
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy