Package de.netseeker.ejoe.io

Examples of de.netseeker.ejoe.io.ByteBufferOutputStream


     * @return a ByteBuffer containing the encoded HTTP request data
     */
    public ByteBuffer toByteBuffer()
    {
        ByteBuffer result = null;
        ByteBufferOutputStream lOut = null;

        try
        {
            lOut = new ByteBufferOutputStream();
            lOut.write( IOUtil.encodeToBytes( toHeaderString(), CHARSET ) );
            ByteBuffer buffer = this._out.getBackingBuffer();
            int pos = buffer.position();
            int limit = buffer.limit();
            buffer.flip();
            lOut.write( buffer );
            result = lOut.getBackingBuffer();
            result.flip();
            buffer.limit( limit );
            buffer.position( pos );
        }
        catch ( IOException e )
View Full Code Here


    private void send( ConnectionHeader serverInfo, ConnectionHeader clientInfo, SelectionKey selKey, Object obj )
            throws IOException
    {
        ByteBuffer dataBuf = (ByteBuffer) selKey.attachment();
        DataChannel dataChannel = DataChannel.getInstance( serverInfo );
        ByteBufferOutputStream out = null;

        try
        {
            if ( dataBuf == null )
            {
                // usual way: serialize using a adapter
                if ( !clientInfo.isDirect() )
                {
                    out = new ByteBufferOutputStream();
                    serialize( out, obj, clientInfo );
                    dataBuf = out.getBackingBuffer();
                }
                // direct mode: just use the attachement
                else
                {
                    dataBuf = (ByteBuffer) obj;
View Full Code Here

    /**
     * @throws IOException
     */
    private void write() throws IOException
    {
        ByteBufferOutputStream out = null;
        ByteBuffer dataBuf = null;
        SerializeAdapter adapter = this._receiverInfo.getAdapterName() != null ? AdapterFactory
                .createAdapter( this._receiverInfo.getAdapterName() ) : null;
        WritableByteChannel channel = this._receiverInfo.getChannel();
        DataChannel dataChannel = DataChannel.getInstance( this._receiverInfo );

        try
        {
            if ( this._receiverInfo.hasAttachment() )
            {
                // usual way: convert the serialized object to a ByteBuffer
                if ( !this._receiverInfo.isDirect() )
                {
                    out = new ByteBufferOutputStream();
                    serialize( adapter, out );
                    dataBuf = out.getBackingBuffer();
                }
                // direct mode: just use the attachement
                else
                {
                    ByteBuffer tmp = (ByteBuffer) this._receiverInfo.getAttachment();
View Full Code Here

TOP

Related Classes of de.netseeker.ejoe.io.ByteBufferOutputStream

Copyright © 2018 www.massapicom. 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.