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

This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
 
    /** 
     * @tests {@link java.nio.channels.IllegalBlockingModeException#IllegalBlockingModeException()} 
     */ 
    public void test_Constructor() { 
        IllegalBlockingModeException e = new IllegalBlockingModeException();
        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.IllegalBlockingModeException#IllegalBlockingModeException()} 
     */ 
    public void test_Constructor() { 
        IllegalBlockingModeException e = new IllegalBlockingModeException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    public void testSerializationSelf() throws Exception { 
 
        SerializationTest.verifySelf(new IllegalBlockingModeException());
    } 
 
    /** 
6
CodeRank
This code example shows how to use the following methods:getCause, getLocalizedMessage, getMessage
     
    /** 
     * @tests {@link java.nio.channels.IllegalBlockingModeException#IllegalBlockingModeException()} 
     */ 
    public void test_Constructor() { 
        IllegalBlockingModeException e = new IllegalBlockingModeException();
        assertNull(e.getMessage());
        assertNull(e.getLocalizedMessage());
        assertNull(e.getCause());
    } 
 
    /** 
     * @tests serialization/deserialization compatibility. 
     */ 
    public void testSerializationSelf() throws Exception {
 
        SerializationTest.verifySelf(new IllegalBlockingModeException());
    } 
 
    /** 
6
CodeRank
This code example shows how to use the following methods:
            if (0 > offset || 0 > count || count + offset > buffer.length) {
                throw new IndexOutOfBoundsException();
            } 
            ByteBuffer buf = ByteBuffer.wrap(buffer, offset, count);
            if (!channel.isBlocking()) {
                throw new IllegalBlockingModeException();
            } 
            channel.write(buf);
        } 
 
        /** 
         * @see java.io.OutputStream#write(int) 
         */ 
        @Override 
        public void write(int oneByte) throws IOException {
            if (!channel.isBlocking()) {
                throw new IllegalBlockingModeException();
            } 
            ByteBuffer buffer = ByteBuffer.allocate(1);
            buffer.put(0, (byte) (oneByte & 0xFF));
4
CodeRank
This code example shows how to use the following methods:
      { 
        throw new IllegalArgumentException ("socket address is not a local address");
      } 
    if (getChannel() != null && !getChannel().isBlocking())
      { 
        throw new IllegalBlockingModeException ();
      } 
 
    try 
      { 
        localimpl.doCreate ();
        localimpl.localConnect ((LocalSocketAddress) endpoint);
      } 
    catch (IOException ioe)
      { 
        close (); 
        throw ioe;
      } 
    localConnected = true;
  } 
3
CodeRank
This code example shows how to use the following methods:
         * @see java.net.DatagramSocket#receive(java.net.DatagramPacket) 
         */ 
        @Override 
        public void receive(DatagramPacket packet) throws IOException {
            if (!channelImpl.isBlocking()) {
                throw new IllegalBlockingModeException();
            } 
            super.receive(packet);
        } 
 
        /** 
         * @see java.net.DatagramSocket#send(java.net.DatagramPacket) 
         */ 
        @Override 
        public void send(DatagramPacket packet) throws IOException {
            if (!channelImpl.isBlocking()) {
                throw new IllegalBlockingModeException();
            } 
            super.send(packet);
        } 
3
CodeRank
This code example shows how to use the following methods:
         * @see java.io.InputStream#read() 
         */ 
        @Override 
        public int read() throws IOException { 
            if (!channel.isBlocking()) {
                throw new IllegalBlockingModeException();
            } 
            ByteBuffer buf = ByteBuffer.allocate(1);
            int result = channel.read(buf);
            // BEGIN android-changed: input was already consumed 
            return (-1 == result) ? result : buf.get(0) & 0xFF;
            // END android-changed 
        } 
 
        /* 
         * @see java.io.InputStream#read(byte[], int, int) 
         */ 
        @Override 
        public int read(byte[] buffer, int offset, int count)
                throws IOException { 
3
CodeRank
This code example shows how to use the following methods:
 
  public int read(byte[] buf, int off, int len) throws IOException
  { 
    if (ch instanceof SelectableChannel
        && (! ((SelectableChannel) ch).isBlocking()))
      throw new IllegalBlockingModeException();
 
    ByteBuffer b = ByteBuffer.wrap(buf, off, len);
    return ch.read(b);
  } 
 
  public int read() throws IOException 
  { 
    if (ch instanceof SelectableChannel
        && (! ((SelectableChannel) ch).isBlocking()))
      throw new IllegalBlockingModeException();
 
    ByteBuffer buffer = ByteBuffer.allocate(1);
    int result = ch.read(buffer);
 
4
CodeRank
This code example shows how to use the following methods:
 
  public int read(byte[] buf, int off, int len) throws IOException
  { 
    if (ch instanceof SelectableChannel
        && (! ((SelectableChannel) ch).isBlocking()))
      throw new IllegalBlockingModeException();
 
    ByteBuffer b = ByteBuffer.wrap(buf, off, len);
    return ch.read(b);
  } 
 
  public int read() throws IOException 
  { 
    if (ch instanceof SelectableChannel
        && (! ((SelectableChannel) ch).isBlocking()))
      throw new IllegalBlockingModeException();
 
    ByteBuffer buffer = ByteBuffer.allocate(1);
    int result = ch.read(buffer);
 
4
CodeRank
This code example shows how to use the following methods:
        } 
 
        @Override 
        public void connect(SocketAddress remoteAddr, int timeout) throws IOException {
            if (!channel.isBlocking()) {
                throw new IllegalBlockingModeException();
            } 
            if (isConnected()) { 
                throw new AlreadyConnectedException();
            } 
            super.connect(remoteAddr, timeout);
            channel.initLocalAddressAndPort();
            if (super.isConnected()) { 
                channel.setConnected();
                channel.isBound = super.isBound();
            } 
        } 
 
        @Override 
        public void bind(SocketAddress localAddr) throws IOException {
4
CodeRank
See Code Examples for Java 8 IllegalBlockingModeException Methods: