當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。