Code example for NotYetConnectedException

0
 
  public int write (ByteBuffer src)
    throws IOException 
  { 
    if (!isConnected ()) 
      throw new NotYetConnectedException ();
 
    return channel.write(src);
  } 
 
  public long write (ByteBuffer[] srcs, int offset, int length)
    throws IOException 
  { 
    if (!isConnected()) 
      throw new NotYetConnectedException();
 
    if ((offset < 0)
        || (offset > srcs.length)
        || (length < 0)
        || (length > (srcs.length - offset)))
      throw new IndexOutOfBoundsException();