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

com.firefly.client.http2.HTTP2ClientDecoder Maven / Gradle / Ivy

package com.firefly.client.http2;

import com.firefly.net.DecoderChain;
import com.firefly.net.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.nio.ByteBuffer;

public class HTTP2ClientDecoder extends DecoderChain {

	private static Logger log = LoggerFactory.getLogger("firefly-system");

	@Override
	public void decode(ByteBuffer buffer, Session session) throws Throwable {
		if(!buffer.hasArray()) {
			throw new IllegalArgumentException("the byte buffer has not array");
		}
		
		if (!buffer.hasRemaining())
			return;

		if (log.isDebugEnabled())
			log.debug("the client session {} received the {} bytes", session.getSessionId(), buffer.remaining());

		HTTP2ClientConnection http2ClientConnection = (HTTP2ClientConnection) session.getAttachment();
		http2ClientConnection.getParser().parse(buffer);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy