Java 8 NonWritableChannelException - 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 NonWritableChannelException class.

This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
 
    /** 
     * @tests {@link java.nio.channels.NonWritableChannelException#NonWritableChannelException()} 
     */ 
    public void test_Constructor() { 
        NonWritableChannelException e = new NonWritableChannelException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    @TestTargets({ 
        @TestTargetNew( 
            level = TestLevel.COMPLETE, 
            notes = "Verifies serialization/deserialization compatibility.", 
            method = "!SerializationSelf", 
            args = {} 
7
CodeRank
This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
     
    /** 
     * @tests {@link java.nio.channels.NonWritableChannelException#NonWritableChannelException()} 
     */ 
    public void test_Constructor() { 
        NonWritableChannelException e = new NonWritableChannelException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    public void testSerializationSelf() throws Exception {
 
        SerializationTest.verifySelf(new NonWritableChannelException());
    } 
 
    /** 
6
CodeRank
This code example shows how to use the following methods:
            throw new NullPointerException();
        } 
        if (position < 0) {
            throw new IllegalArgumentException();
        } 
        throw new NonWritableChannelException();
    } 
 
    public final int write(ByteBuffer buffer) throws IOException {
        openCheck(); 
        throw new NonWritableChannelException();
    } 
 
    public final long write(ByteBuffer[] buffers, int offset, int length)
            throws IOException { 
        if (offset < 0 || length < 0 || (offset + length) > buffers.length) {
            throw new IndexOutOfBoundsException();
        } 
        openCheck(); 
        throw new NonWritableChannelException();
5
CodeRank
This code example shows how to use the following methods:
 
    if (!isOpen ())
      throw new ClosedChannelException ();
 
    if ((mode & WRITE) == 0)
       throw new NonWritableChannelException ();
 
    int result;
    long oldPosition;
 
    oldPosition = implPosition ();
    seek (position);
    result = write(src);
    seek (oldPosition);
 
    return result;
  } 
 
  public void write (int b) throws IOException
  { 
4
CodeRank
This code example shows how to use the following methods:
 
    if (!isOpen ())
      throw new ClosedChannelException ();
 
    if ((mode & WRITE) == 0)
       throw new NonWritableChannelException ();
 
    int result;
    long oldPosition;
 
    oldPosition = implPosition ();
    seek (position);
    result = write(src);
    seek (oldPosition);
 
    return result;
  } 
 
  public void write (int b) throws IOException
  { 
3
CodeRank
This code example shows how to use the following methods:
            throw new NullPointerException();
        } 
        if (position < 0) {
            throw new IllegalArgumentException();
        } 
        throw new NonWritableChannelException();
    } 
 
    public final int write(ByteBuffer buffer) throws IOException {
        openCheck(); 
        throw new NonWritableChannelException();
    } 
 
    public final long write(ByteBuffer[] buffers, int offset, int length)
            throws IOException { 
        if (offset < 0 || length < 0 || (offset + length) > buffers.length) {
            throw new IndexOutOfBoundsException();
        } 
        openCheck(); 
        throw new NonWritableChannelException();
4
CodeRank
This code example shows how to use the following methods:
 
    if (!isOpen ())
      throw new ClosedChannelException ();
     
    if ((mode & WRITE) == 0)
       throw new NonWritableChannelException ();
 
    int result;
    long oldPosition;
 
    oldPosition = implPosition ();
    seek (position);
    result = write(src);
    seek (oldPosition);
     
    return result;
  } 
 
  public native void write (byte[] buffer, int offset, int length)
    throws IOException; 
3
CodeRank
This code example shows how to use the following methods:
 
    if (!isOpen ())
      throw new ClosedChannelException ();
     
    if ((mode & WRITE) == 0)
       throw new NonWritableChannelException ();
 
    int result;
    long oldPosition;
 
    oldPosition = implPosition ();
    seek (position);
    result = write(src);
    seek (oldPosition);
     
    return result;
  } 
 
  public native void write (byte[] buffer, int offset, int length)
    throws IOException; 
4
CodeRank
This code example shows how to use the following methods:
    } 
 
    @Override 
    public UnixSshSeekableByteChannel truncate( long size ) throws IOException {
        if ( !writeable ) {
            throw new NonWritableChannelException();
        } 
        if ( size < 0 ) {
            throw new IllegalArgumentException( "size must be positive" );
        } 
        if ( size >= this.size ) {
            return this;
        } 
 
        provider.truncateFile( path, position );
        if ( position > size ) {
            position = size;
        } 
        this.size = size;
        return this;
3
CodeRank
This code example shows how to use the following methods:
 
    /** 
     * @see java.nio.channels.WritableByteChannel#write(java.nio.ByteBuffer) 
     */ 
    public int write(ByteBuffer src) throws IOException {
        throw new NonWritableChannelException();
    } 
 
    /** 
     * @see java.nio.channels.Channel#close() 
     */ 
    public void close() throws IOException {
    } 
 
    /** 
     * @see java.nio.channels.Channel#isOpen() 
     */ 
    public boolean isOpen() { 
        return true; 
    } 
3
CodeRank
See Code Examples for Java 8 NonWritableChannelException Methods: