RuneHive-Game
Loading...
Searching...
No Matches
dev.advo.fs.net.service.ServiceRequestDecoder Class Reference
Inheritance diagram for dev.advo.fs.net.service.ServiceRequestDecoder:
Collaboration diagram for dev.advo.fs.net.service.ServiceRequestDecoder:

Public Member Functions

 ServiceRequestDecoder ()
 Creates the decoder, enabling the 'unfold' mechanism.

Protected Member Functions

Object decode (ChannelHandlerContext ctx, Channel c, ChannelBuffer buf) throws Exception

Detailed Description

Definition at line 10 of file ServiceRequestDecoder.java.

Constructor & Destructor Documentation

◆ ServiceRequestDecoder()

dev.advo.fs.net.service.ServiceRequestDecoder.ServiceRequestDecoder ( )

Creates the decoder, enabling the 'unfold' mechanism.

Definition at line 15 of file ServiceRequestDecoder.java.

15 {
16 super(true);
17 }

Member Function Documentation

◆ decode()

Object dev.advo.fs.net.service.ServiceRequestDecoder.decode ( ChannelHandlerContext ctx,
Channel c,
ChannelBuffer buf ) throws Exception
protected

Definition at line 20 of file ServiceRequestDecoder.java.

20 {
21 if (buf.readable()) {
22 ServiceRequest request = new ServiceRequest(buf.readUnsignedByte());
23
24 //System.out.println("initial request " + request.getId());
25 //if not 0. oof.
26
27 ChannelPipeline pipeline = ctx.getPipeline();
28 pipeline.remove(this);
29
30 if (buf.readable()) {
31 //System.out.println("we should not be here, client should request 1 byte. It requested "+ buf.readableBytes());
32 System.out.println("we should not be here, client should request 1 byte. It requested "+ buf.readableBytes());
33
34 ChannelBuffer b = ChannelBuffers.buffer(1 + buf.readableBytes());
35 b.writeByte(1);
36 b.writeBytes(buf.readBytes(buf.readableBytes()));
37
38 return new Object[] { request,
39 b
40 };
41 } else {
42 return request;
43 }
44 }
45 return null;
46 }

The documentation for this class was generated from the following file: