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

This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
 
    /** 
     * @tests {@link java.nio.channels.NonReadableChannelException#NonReadableChannelException()} 
     */ 
    public void test_Constructor() { 
        NonReadableChannelException e = new NonReadableChannelException();
        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.NonReadableChannelException#NonReadableChannelException()} 
     */ 
    public void test_Constructor() { 
        NonReadableChannelException e = new NonReadableChannelException();
        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 = {} 
6
CodeRank
This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
     
    /** 
     * @tests {@link java.nio.channels.NonReadableChannelException#NonReadableChannelException()} 
     */ 
    public void test_Constructor() { 
        NonReadableChannelException e = new NonReadableChannelException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    public void testSerializationSelf() throws Exception {
 
        SerializationTest.verifySelf(new NonReadableChannelException());
    } 
 
    /** 
6
CodeRank
This code example shows how to use the following methods:
            throws IOException { 
        openCheck(); 
        if (!target.isOpen()) {
            throw new ClosedChannelException();
        } 
        throw new NonReadableChannelException();
    } 
 
    public long read(ByteBuffer[] buffers, int offset, int length)
            throws IOException { 
        if (offset < 0 || length < 0 || offset + length > buffers.length) {
            throw new IndexOutOfBoundsException();
        } 
        openCheck(); 
        throw new NonReadableChannelException();
    } 
 
    public int read(ByteBuffer buffer) throws IOException {
        openCheck(); 
        throw new NonReadableChannelException();
5
CodeRank
This code example shows how to use the following methods:
nmode = mode == MapMode.READ_WRITE ? '+' : 'c';
        if ((this.mode & WRITE) != WRITE)
          throw new NonWritableChannelException();
        if ((this.mode & READ) != READ)
          throw new NonReadableChannelException();
      } 
    else 
      throw new IllegalArgumentException ("mode: " + mode);
 
    if (position < 0 || size < 0 || size > Integer.MAX_VALUE)
      throw new IllegalArgumentException ("position: " + position
                                          + ", size: " + size);
    return ch.map(nmode, position, (int) size);
  } 
 
  /** 
   * msync with the disk 
   */ 
  public void force (boolean metaData) throws IOException
4
CodeRank
This code example shows how to use the following methods:
    char nmode = 0;
    if (mode == MapMode.READ_ONLY)
      { 
        nmode = 'r';
        if ((this.mode & READ) == 0)
          throw new NonReadableChannelException();
      } 
    else if (mode == MapMode.READ_WRITE || mode == MapMode.PRIVATE)
      { 
        nmode = mode == MapMode.READ_WRITE ? '+' : 'c';
        if ((this.mode & WRITE) != WRITE)
          throw new NonWritableChannelException();
        if ((this.mode & READ) != READ)
          throw new NonReadableChannelException();
      } 
    else 
      throw new IllegalArgumentException ("mode: " + mode);
 
    if (position < 0 || size < 0 || size > Integer.MAX_VALUE)
      throw new IllegalArgumentException ("position: " + position
3
CodeRank
This code example shows how to use the following methods:
            throws IOException { 
        openCheck(); 
        if (!target.isOpen()) {
            throw new ClosedChannelException();
        } 
        throw new NonReadableChannelException();
    } 
 
    public long read(ByteBuffer[] buffers, int offset, int length)
            throws IOException { 
        if (offset < 0 || length < 0 || offset + length > buffers.length) {
            throw new IndexOutOfBoundsException();
        } 
        openCheck(); 
        throw new NonReadableChannelException();
    } 
 
    public int read(ByteBuffer buffer) throws IOException {
        openCheck(); 
        throw new NonReadableChannelException();
4
CodeRank
This code example shows how to use the following methods:
    char nmode = 0;
    if (mode == MapMode.READ_ONLY)
      { 
	nmode = 'r';
	if ((this.mode & READ) == 0)
	  throw new NonReadableChannelException();
      } 
    else if (mode == MapMode.READ_WRITE || mode == MapMode.PRIVATE)
      { 
	nmode = mode == MapMode.READ_WRITE ? '+' : 'c';
	if ((this.mode & (READ|WRITE)) != (READ|WRITE))
	  throw new NonWritableChannelException();
      } 
    else 
      throw new IllegalArgumentException ();
     
    if (position < 0 || size < 0 || size > Integer.MAX_VALUE)
      throw new IllegalArgumentException ();
    return mapImpl(nmode, position, (int) size);
  } 
3
CodeRank
This code example shows how to use the following methods:
    char nmode = 0;
    if (mode == MapMode.READ_ONLY)
      { 
	nmode = 'r';
	if ((this.mode & READ) == 0)
	  throw new NonReadableChannelException();
      } 
    else if (mode == MapMode.READ_WRITE || mode == MapMode.PRIVATE)
      { 
	nmode = mode == MapMode.READ_WRITE ? '+' : 'c';
	if ((this.mode & (READ|WRITE)) != (READ|WRITE))
	  throw new NonWritableChannelException();
      } 
    else 
      throw new IllegalArgumentException ();
     
    if (position < 0 || size < 0 || size > Integer.MAX_VALUE)
      throw new IllegalArgumentException ();
    return mapImpl(nmode, position, (int) size);
  } 
4
CodeRank
This code example shows how to use the following methods:
    } 
 
    @Override 
    public int read( ByteBuffer bytes ) throws IOException {
        if ( !readable ) {
            throw new NonReadableChannelException();
        } 
        if ( position >= size ) {
            return -1; 
        } 
 
        int read = provider.read( path, position, bytes );
        position += read;
        if ( position > size ) {
            // sucks, means somebody else is also writing this file, bad things 
            // are gonna happen here... 
            size = position;
        } 
 
        return read;
3
CodeRank
See Code Examples for Java 8 NonReadableChannelException Methods: