当前位置: 首页>>代码示例>>Java>>正文


Java BufferOverflowException类代码示例

本文整理汇总了Java中java.nio.BufferOverflowException的典型用法代码示例。如果您正苦于以下问题:Java BufferOverflowException类的具体用法?Java BufferOverflowException怎么用?Java BufferOverflowException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BufferOverflowException类属于java.nio包,在下文中一共展示了BufferOverflowException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: encode

import java.nio.BufferOverflowException; //导入依赖的package包/类
/**
 * Encode the AddResponse message to a PDU.
 * 
 * @param buffer The buffer where to put the PDU
 * @return The encoded response
 * @throws EncoderException If teh encoding failed
 */
@Override
public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
{
    try
    {
        // The AddResponse Tag
        buffer.put( LdapCodecConstants.ADD_RESPONSE_TAG );
        buffer.put( TLV.getBytes( addResponseLength ) );

        // The LdapResult
        ( ( LdapResultDecorator ) getLdapResult() ).encode( buffer );

        return buffer;
    }
    catch ( BufferOverflowException boe )
    {
        throw new EncoderException( I18n.err( I18n.ERR_04005 ), boe );
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:27,代码来源:AddResponseDecorator.java

示例2: encode

import java.nio.BufferOverflowException; //导入依赖的package包/类
/**
 * Encode a String value
 *
 * @param buffer The PDU in which the value will be put
 * @param string The String to be encoded. It is supposed to be UTF-8
 * @throws EncoderException if the PDU in which the value should be encoded is
 * two small
 */
public static void encode( ByteBuffer buffer, String string ) throws EncoderException
{
    if ( buffer == null )
    {
        throw new EncoderException( I18n.err( I18n.ERR_00003_CANNOT_PUT_PDU_IN_NULL_BUFFER ) );
    }

    try
    {
        buffer.put( UniversalTag.OCTET_STRING.getValue() );

        byte[] value = Asn1StringUtils.getBytesUtf8( string );

        buffer.put( TLV.getBytes( value.length ) );

        if ( value.length != 0 )
        {
            buffer.put( value );
        }
    }
    catch ( BufferOverflowException boe )
    {
        throw new EncoderException( I18n.err( I18n.ERR_00004_PDU_BUFFER_SIZE_TOO_SMALL ), boe );
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:34,代码来源:BerValue.java

示例3: encodeEnumerated

import java.nio.BufferOverflowException; //导入依赖的package包/类
/**
 * Encode an enumerated value
 *
 * @param buffer The PDU in which the value will be put
 * @param value The integer to be encoded
 * @throws EncoderException if the PDU in which the value should be encoded is
 * two small
 */
public static void encodeEnumerated( ByteBuffer buffer, int value ) throws EncoderException
{
    if ( buffer == null )
    {
        throw new EncoderException( I18n.err( I18n.ERR_00003_CANNOT_PUT_PDU_IN_NULL_BUFFER ) );
    }

    try
    {
        buffer.put( UniversalTag.ENUMERATED.getValue() );
        buffer.put( TLV.getBytes( getNbBytes( value ) ) );
        buffer.put( getBytes( value ) );
    }
    catch ( BufferOverflowException boe )
    {
        throw new EncoderException( I18n.err( I18n.ERR_00004_PDU_BUFFER_SIZE_TOO_SMALL ), boe );
    }
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:27,代码来源:BerValue.java

示例4: encode

import java.nio.BufferOverflowException; //导入依赖的package包/类
/**
 * Encode the Unbind protocolOp part
 */
@Override
public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
{
    try
    {
        // The tag
        buffer.put( LdapCodecConstants.UNBIND_REQUEST_TAG );

        // The length is always null.
        buffer.put( ( byte ) 0 );
    }
    catch ( BufferOverflowException boe )
    {
        String msg = I18n.err( I18n.ERR_04005 );
        throw new EncoderException( msg, boe );
    }

    return buffer;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:23,代码来源:UnbindRequestDecorator.java

示例5: encode

import java.nio.BufferOverflowException; //导入依赖的package包/类
/**
 * Encode the DelRequest message to a PDU.
 * <br>
 * DelRequest :
 * <pre>
 * 0x4A LL entry
 * </pre>
 * 
 * @param buffer The buffer where to put the PDU
 */
@Override
public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
{
    try
    {
        // The DelRequest Tag
        buffer.put( LdapCodecConstants.DEL_REQUEST_TAG );

        // The entry
        buffer.put( TLV.getBytes( dnBytes.length ) );
        buffer.put( dnBytes );
    }
    catch ( BufferOverflowException boe )
    {
        throw new EncoderException( I18n.err( I18n.ERR_04005 ), boe );
    }

    return buffer;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:30,代码来源:DeleteRequestDecorator.java

示例6: encode

import java.nio.BufferOverflowException; //导入依赖的package包/类
/**
 * Encode the DelResponse message to a PDU.
 * 
 * @param buffer The buffer where to put the PDU
 */
@Override
public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
{
    try
    {
        // The DelResponse Tag
        buffer.put( LdapCodecConstants.DEL_RESPONSE_TAG );
        buffer.put( TLV.getBytes( deleteResponseLength ) );

        // The LdapResult
        ( ( LdapResultDecorator ) getLdapResult() ).encode( buffer );
    }
    catch ( BufferOverflowException boe )
    {
        throw new EncoderException( I18n.err( I18n.ERR_04005 ), boe );
    }

    return buffer;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:25,代码来源:DeleteResponseDecorator.java

示例7: encode

import java.nio.BufferOverflowException; //导入依赖的package包/类
/**
 * Encode the ModifyResponse message to a PDU.
 * 
 * @param buffer The buffer where to put the PDU
 */
@Override
public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
{
    try
    {
        // The ModifyResponse Tag
        buffer.put( LdapCodecConstants.MODIFY_RESPONSE_TAG );
        buffer.put( TLV.getBytes( modifyResponseLength ) );

        // The LdapResult
        ( ( LdapResultDecorator ) getLdapResult() ).encode( buffer );
    }
    catch ( BufferOverflowException boe )
    {
        throw new EncoderException( I18n.err( I18n.ERR_04005 ), boe );
    }

    return buffer;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:25,代码来源:ModifyResponseDecorator.java

示例8: encode

import java.nio.BufferOverflowException; //导入依赖的package包/类
/**
 * Encode the Abandon protocolOp part
 */
@Override
public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
{
    try
    {
        // The tag
        buffer.put( LdapCodecConstants.ABANDON_REQUEST_TAG );

        // The length. It has to be evaluated depending on
        // the abandoned messageId value.
        buffer.put( ( byte ) BerValue.getNbBytes( getAbandoned() ) );

        // The abandoned messageId
        buffer.put( BerValue.getBytes( getAbandoned() ) );
    }
    catch ( BufferOverflowException boe )
    {
        String msg = I18n.err( I18n.ERR_04005 );
        throw new EncoderException( msg, boe );
    }

    return buffer;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:27,代码来源:AbandonRequestDecorator.java

示例9: encode

import java.nio.BufferOverflowException; //导入依赖的package包/类
/**
 * Encode the CompareResponse message to a PDU.
 * 
 * @param buffer The buffer where to put the PDU
 */
@Override
public ByteBuffer encode( ByteBuffer buffer )
    throws EncoderException
{
    try
    {
        // The CompareResponse Tag
        buffer.put( LdapCodecConstants.COMPARE_RESPONSE_TAG );
        buffer.put( TLV.getBytes( compareResponseLength ) );

        // The LdapResult
        ( ( LdapResultDecorator ) getLdapResult() ).encode( buffer );
    }
    catch ( BufferOverflowException boe )
    {
        throw new EncoderException( I18n.err( I18n.ERR_04005 ), boe );
    }

    return buffer;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:26,代码来源:CompareResponseDecorator.java

示例10: encode

import java.nio.BufferOverflowException; //导入依赖的package包/类
/**
 * Encode the SearchResultDone message to a PDU.
 * 
 * @param buffer The buffer where to put the PDU
 * return The encoded response
 * @throws EncoderException If the encoding failed
 */
@Override
public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
{
    try
    {
        // The searchResultDone Tag
        buffer.put( LdapCodecConstants.SEARCH_RESULT_DONE_TAG );
        buffer.put( TLV.getBytes( searchResultDoneLength ) );

        // The LdapResult
        ( ( LdapResultDecorator ) getLdapResult() ).encode( buffer );
    }
    catch ( BufferOverflowException boe )
    {
        throw new EncoderException( I18n.err( I18n.ERR_04005 ), boe );
    }

    return buffer;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:27,代码来源:SearchResultDoneDecorator.java

示例11: encode

import java.nio.BufferOverflowException; //导入依赖的package包/类
/**
 * Encode the ModifyDnResponse message to a PDU.
 * 
 * @param buffer The buffer where to put the PDU
 */
@Override
public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
{
    try
    {
        // The ModifyResponse Tag
        buffer.put( LdapCodecConstants.MODIFY_DN_RESPONSE_TAG );
        buffer.put( TLV.getBytes( modifyDnResponseLength ) );

        // The LdapResult
        ( ( LdapResultDecorator ) getLdapResult() ).encode( buffer );
    }
    catch ( BufferOverflowException boe )
    {
        throw new EncoderException( I18n.err( I18n.ERR_04005 ), boe );
    }

    return buffer;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:25,代码来源:ModifyDnResponseDecorator.java

示例12: encode

import java.nio.BufferOverflowException; //导入依赖的package包/类
/**
 * Encode the OrFilter message to a PDU. 
 * <br>
 * OrFilter :
 * <pre> 
 *   0xA1 LL filter.encode()
 * </pre>
 * 
 * @param buffer The buffer where to put the PDU
 * @return The PDU.
 */
@Override
public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
{
    if ( buffer == null )
    {
        throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
    }

    try
    {
        // The OrFilter Tag
        buffer.put( ( byte ) LdapCodecConstants.OR_FILTER_TAG );
        buffer.put( TLV.getBytes( filtersLength ) );
    }
    catch ( BufferOverflowException boe )
    {
        throw new EncoderException( I18n.err( I18n.ERR_04005 ), boe );
    }

    super.encode( buffer );

    return buffer;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:35,代码来源:OrFilter.java

示例13: encode

import java.nio.BufferOverflowException; //导入依赖的package包/类
/**
 * Encode the PresentFilter message to a PDU. PresentFilter : 0x87 LL
 * attributeDescription
 * 
 * @param buffer The buffer where to put the PDU
 * @return The PDU.
 */
@Override
public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
{
    if ( buffer == null )
    {
        throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
    }

    try
    {
        // The PresentFilter Tag
        buffer.put( ( byte ) LdapCodecConstants.PRESENT_FILTER_TAG );
        buffer.put( TLV.getBytes( attributeDescriptionBytes.length ) );
        buffer.put( attributeDescriptionBytes );
    }
    catch ( BufferOverflowException boe )
    {
        throw new EncoderException( I18n.err( I18n.ERR_04005 ), boe );
    }

    return buffer;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:30,代码来源:PresentFilter.java

示例14: encode

import java.nio.BufferOverflowException; //导入依赖的package包/类
/**
 * Encode the AndFilter message to a PDU. 
 * <br>
 * AndFilter :
 * <pre> 
 * 0xA0 LL
 *  filter.encode() ... filter.encode()
 * </pre>
 * 
 * @param buffer The buffer where to put the PDU
 * @return The PDU.
 */
@Override
public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
{
    if ( buffer == null )
    {
        throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
    }

    try
    {
        // The AndFilter Tag
        buffer.put( ( byte ) LdapCodecConstants.AND_FILTER_TAG );
        buffer.put( TLV.getBytes( filtersLength ) );
    }
    catch ( BufferOverflowException boe )
    {
        throw new EncoderException( I18n.err( I18n.ERR_04005 ), boe );
    }

    super.encode( buffer );

    return buffer;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:36,代码来源:AndFilter.java

示例15: encode

import java.nio.BufferOverflowException; //导入依赖的package包/类
/**
 * Encode the NotFilter message to a PDU. 
 * <br>
 * NotFilter :
 * <pre> 
 * 0xA2 LL filter.encode()
 * </pre>
 * 
 * @param buffer The buffer where to put the PDU
 * @return The PDU.
 */
@Override
public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
{
    if ( buffer == null )
    {
        throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
    }

    try
    {
        // The NotFilter Tag
        buffer.put( ( byte ) LdapCodecConstants.NOT_FILTER_TAG );
        buffer.put( TLV.getBytes( filtersLength ) );
    }
    catch ( BufferOverflowException boe )
    {
        throw new EncoderException( I18n.err( I18n.ERR_04005 ), boe );
    }

    super.encode( buffer );

    return buffer;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:35,代码来源:NotFilter.java


注:本文中的java.nio.BufferOverflowException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。