Package org.apache.mina.core.buffer

Examples of org.apache.mina.core.buffer.IoBuffer.flip()


                    if (ret > 0) {
                        readBytes = ret;
                    }
                }
            } finally {
                buf.flip();
            }

            if (readBytes > 0) {
                IoFilterChain filterChain = session.getFilterChain();
                filterChain.fireMessageReceived(buf);
View Full Code Here


                        if (readBytes > 0) {
                            IoBuffer buf = IoBuffer
                                    .wrap(data, 0, readBytes);
                            buf.put(data, 0, readBytes);
                            buf.flip();
                            getFilterChain().fireMessageReceived(
                                    buf);
                        }
                    } catch (IOException e) {
                        getFilterChain().fireExceptionCaught(
View Full Code Here

       
        if (remoteAddress != null) {
            IoSession session = newSessionWithoutLock(
                    remoteAddress, localAddress(handle));

            readBuf.flip();

            IoBuffer newBuf = IoBuffer.allocate(readBuf.limit());
            newBuf.put(readBuf);
            newBuf.flip();
View Full Code Here

            readBuf.flip();

            IoBuffer newBuf = IoBuffer.allocate(readBuf.limit());
            newBuf.put(readBuf);
            newBuf.flip();

            session.getFilterChain().fireMessageReceived(newBuf);
        }
    }
View Full Code Here

        buf.put(body);
        buf.put((byte)config.getEndByte1());
        buf.put((byte)config.getEndByte2());

        // flip the buffer so we can use it to write to the out stream
        buf.flip();
        LOG.debug("Encoded HL7 from {} to byte stream", message.getClass().getCanonicalName());
        out.write(buf);
    }

}
View Full Code Here

       
        ByteBuffer encodedByteBuf = ChangePasswordEncoder.encode( ( AbstractPasswordMessage ) message, isTcp );
       
        IoBuffer buf = IoBuffer.allocate( encodedByteBuf.remaining() );
        buf.put( encodedByteBuf.array() );
        buf.flip();
        out.write( buf );
    }
}
View Full Code Here

            @Override
            public void messageReceived(IoSession session, Object message) throws Exception {
                IoBuffer recv = (IoBuffer) message;
                IoBuffer sent = IoBuffer.allocate(recv.remaining());
                sent.put(recv);
                sent.flip();
                session.write(sent);
            }
        });
        acceptor.setReuseAddress(true);
        acceptor.bind(new InetSocketAddress(echoPort));
View Full Code Here

        boolean isTcp = !session.getTransportMetadata().isConnectionless();

        ByteBuffer encodedByteBuf = KerberosEncoder.encode( asn1Obj, isTcp );
        IoBuffer buf = IoBuffer.allocate( encodedByteBuf.remaining() );
        buf.put( encodedByteBuf.array() );
        buf.flip();
        out.write( buf );
    }
}
View Full Code Here

            @Override
            public void messageReceived(IoSession session, Object message) throws Exception {
                IoBuffer recv = (IoBuffer) message;
                IoBuffer sent = IoBuffer.allocate(recv.remaining());
                sent.put(recv);
                sent.flip();
                session.write(sent);
            }
        });
        acceptor.setReuseAddress(true);
        acceptor.bind(new InetSocketAddress(echoPort));
View Full Code Here

                tmp.putString(delimiter.getValue(), charset.newEncoder());
            } catch (CharacterCodingException cce) {
               
            }
           
            tmp.flip();
            delimBuf = tmp;
        }
    }

    /**
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.