Java 8 BufferOverflowException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 BufferOverflowException class.

This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
     
    /** 
     *@tests {@link java.nio.BufferOverflowException#BufferOverflowException()} 
     */ 
    public void test_Constructor() { 
        BufferOverflowException exception = new BufferOverflowException();
        assertNull(exception.getMessage());
        assertNull(exception.getLocalizedMessage());
        assertNull(exception.getCause());
    } 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
     
    /** 
     *@tests {@link java.nio.BufferOverflowException#BufferOverflowException()} 
     */ 
    public void test_Constructor() { 
        BufferOverflowException exception = new BufferOverflowException();
        assertNull(exception.getMessage());
        assertNull(exception.getLocalizedMessage());
        assertNull(exception.getCause());
    } 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 
	@Override 
	public void put( byte b ) throws BufferOverflowException
	{ 
		if (isFull()) 
			throw new BufferOverflowException();
		 
		length++;
		buf[nextPut++] = b;
		if (nextPut >= size)
			nextPut = 0;
	} 
 
	@Override 
	public void mark() { 
		mark = nextGet;		
	} 
 
	public int nextGetPosition() { 
		return nextGet;
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	final void checkRange(final int bytes) {
		if ( bytes < 0 )
			throw new IllegalArgumentException();
 
		if ( preventGC.capacity() < (viewAddress - MemoryUtil.getAddress0(preventGC) + bytes) )
			throw new BufferOverflowException();
	} 
 
	/** The mapped object memory alignment, in bytes. Read-only. */ 
	/** 
	 * Returns the mapped object memory alignment, in bytes. 
	 * 
	 * @return the memory alignment 
	 */ 
	public final int getAlign() { 
		// No call-site modification for this, we override in every subclass instead. 
		throw new InternalError("type not registered");
	} 
 
	/** 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
		itsBytes = aBytes;
	} 
	 
	protected void checkRemaining(int aRequested)
	{ 
		if (aRequested > remaining()) throw new BufferOverflowException();
	} 
	 
	public final void put(byte[] aBytes, int aOffset, int aLength)
	{ 
		checkRemaining(aLength);
		int thePos = itsPos;
		System.arraycopy(aBytes, aOffset, itsBytes, thePos, aLength);
		itsPos = thePos+aLength;
	} 
	 
	public final void get(byte[] aBuffer, int aOffset, int aLength)
	{ 
		checkRemaining(aLength);
		int thePos = itsPos;
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        public MockMalfunctionEncoder(Charset cs) {
            super(cs, 1, 3, new byte[] { (byte) '?' });
        } 
 
        protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) {
            throw new BufferOverflowException();
        } 
    } 
 
    /* 
     * Test the method decode(ByteBuffer) . 
     */ 
    @TestTargets({ 
        @TestTargetNew( 
            level = TestLevel.PARTIAL, 
            notes = "Functional test.", 
            method = "decode", 
            args = {java.nio.ByteBuffer.class, java.nio.CharBuffer.class, boolean.class}
        ), 
        @TestTargetNew( 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
		itsData = aData;
	} 
	 
	protected void checkRemaining(int aRequested)
	{ 
		if (aRequested > remaining()) throw new BufferOverflowException();		
	} 
	 
	public final int remaining() 
	{ 
		return itsLimit - itsPos;
	} 
	 
	public final int position() 
	{ 
		return itsPos;
	} 
	 
	public final void position(int aPosition)
	{ 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 
    try 
    { 
      if (buffer.remaining() < b.length())
      { 
        throw new BufferOverflowException();
      } 
 
      final int pos = buffer.position();
      buffer.put(b.getBackingArray(), 0, b.length());
      buffer.limit(buffer.position());
      buffer.position(pos);
    } 
    finally 
    { 
      if (b.capacity() > MAX_BUFFER_LENGTH)
      { 
        b.setCapacity(MAX_BUFFER_LENGTH);
      } 
      b.clear();
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        return capacity() - remainingIn(); 
    } 
 
    public void put(ByteBuffer src) {
        if (src.remaining() > remainingIn())
            throw new BufferOverflowException();
         
        if (src.hasRemaining())
        	lastOut = false;
        else  
        	return; 
         
        initBuffers(); 
        if (src.remaining() > in.remaining()) {
            int oldLimit = src.limit();
            src.limit(src.position() + in.remaining());
            in.put(src);
            in.rewind();
            src.limit(oldLimit);
        } 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
		//if(full) tail = (tail + 1) % buffer.length;  
		head = head % buffer.length;
	} 
	 
	public synchronized T getLast(int n){
		if(n >= buffer.length) throw new BufferOverflowException();
		 
		int ptr = head - n - 1; 
		if(ptr < 0){
			if(!full) throw new BufferUnderflowException();
			else ptr += buffer.length; 
		} 
		 
		return buffer[ptr];
	} 
	 
	public synchronized T getLast(){ 
		return getLast(0); 
	} 
	 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 BufferOverflowException Methods: