CPD Results

The following document contains the results of PMD's CPD 5.2.1.

Duplications

File Line
org/jdtaus/banking/charsets/spi/DIN66003CharsetProvider.java 198
org/jdtaus/banking/charsets/spi/IBM273CharsetProvider.java 453
    DIN66003CharsetEncoder( final Charset charset )
    {
        super( charset, 1f, 1f );
        this.onUnmappableCharacter( CodingErrorAction.REPLACE );
    }

    protected CoderResult encodeLoop( final CharBuffer in, final ByteBuffer buf )
    {
        if ( in.hasArray() && buf.hasArray() )
        {
            return encodeLoopArray( in, buf );
        }

        while ( in.hasRemaining() )
        {
            in.mark();

            final int len;
            if ( in.remaining() < this.charBuf.length )
            {
                len = in.remaining();
                in.get( this.charBuf, 0, in.remaining() );
            }
            else
            {
                in.get( this.charBuf, 0, this.charBuf.length );
                len = this.charBuf.length;
            }

            for ( int i = 0; i < len; i++ )
            {
                if ( !buf.hasRemaining() )
                {
                    in.reset();
                    in.position( in.position() + i );
                    return CoderResult.OVERFLOW;
                }

                if ( !DIN66003Charset.isCharacterSupported( this.charBuf[i] ) )
File Line
org/jdtaus/banking/charsets/spi/DIN66003CharsetProvider.java 280
org/jdtaus/banking/charsets/spi/IBM273CharsetProvider.java 535
    DIN66003CharsetDecoder( final Charset charset )
    {
        super( charset, 1f, 1f );
        this.onUnmappableCharacter( CodingErrorAction.REPLACE );
    }

    protected CoderResult decodeLoop( final ByteBuffer in, final CharBuffer buf )
    {
        if ( in.hasArray() && buf.hasArray() )
        {
            return decodeLoopArray( in, buf );
        }

        while ( in.hasRemaining() )
        {
            in.mark();

            final int len;
            if ( in.remaining() < this.byteBuf.length )
            {
                len = in.remaining();
                in.get( this.byteBuf, 0, in.remaining() );
            }
            else
            {
                in.get( this.byteBuf, 0, this.byteBuf.length );
                len = this.byteBuf.length;
            }

            for ( int i = 0; i < len; i++ )
            {
                if ( !buf.hasRemaining() )
                {
                    in.reset();
                    in.position( in.position() + i );
                    return CoderResult.OVERFLOW;
                }