Package org.apache.mina.common

Examples of org.apache.mina.common.ByteBuffer.release()


        buf.setAutoExpand(true);
        buf.putObject(obj);

        int objectSize = buf.position() - 4;
        if (objectSize > maxObjectSize) {
            buf.release();
            throw new IllegalArgumentException(
                    "The encoded object is too big: " + objectSize + " (> "
                            + maxObjectSize + ')');
        }
View Full Code Here


                    "The encoded object is too big: " + objectSize + " (> "
                            + maxObjectSize + ')');
        }

        out.write(buf.array(), 0, buf.position());
        buf.release();
    }

    public void writeBoolean(boolean v) throws IOException {
        out.writeBoolean(v);
    }
View Full Code Here

        buf.setAutoExpand(true);
        buf.putObject(message);

        int objectSize = buf.position() - 4;
        if (objectSize > maxObjectSize) {
            buf.release();
            throw new IllegalArgumentException(
                    "The encoded object is too big: " + objectSize + " (> "
                            + maxObjectSize + ')');
        }
View Full Code Here

            } finally {
                buf.flip();
                if (buf.hasRemaining()) {
                    out.write(buf);
                } else {
                    buf.release();
                }
            }
        }
    }
View Full Code Here

        in.readFully( buf.array(), 4, objectSize );
        buf.position( 0 );
        buf.limit( objectSize );
       
        Object answer = buf.getObject( classLoader );
        buf.release();
        return answer;
    }

    public boolean readBoolean() throws IOException
    {
View Full Code Here

            {
                break;
            }
   
            newBuf.put( buf );
            buf.release();
        }
       
        // Push the new buffer finally.
        newBuf.flip();
        bufferQueue.push(newBuf);
View Full Code Here

        buf.putObject( obj );
       
        int objectSize = buf.position() - 4;
        if( objectSize > maxObjectSize )
        {
            buf.release();
            throw new IllegalArgumentException( "The encoded object is too big: " + objectSize + " (> " + maxObjectSize + ')' );
        }
       
        out.write( buf.array(), 0, buf.position() );
        buf.release();
View Full Code Here

            buf.release();
            throw new IllegalArgumentException( "The encoded object is too big: " + objectSize + " (> " + maxObjectSize + ')' );
        }
       
        out.write( buf.array(), 0, buf.position() );
        buf.release();
    }

    public void writeBoolean( boolean v ) throws IOException
    {
        out.writeBoolean( v );
View Full Code Here

    private void removeSessionBuffer(IoSession session)
    {       
        ByteBuffer buf = ( ByteBuffer ) session.getAttribute( BUFFER );
        if( buf != null )
        {
            buf.release();
            session.removeAttribute( BUFFER );
        }
    }
   
    private void storeRemainingInSession(ByteBuffer buf, IoSession session)
View Full Code Here

        buf.putObject( message );
       
        int objectSize = buf.position() - 4;
        if( objectSize > maxObjectSize )
        {
            buf.release();
            throw new IllegalArgumentException( "The encoded object is too big: " + objectSize + " (> " + maxObjectSize + ')' );
        }
       
        buf.flip();
        out.write( buf );
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.