Examples of ByteChannel


Examples of java.nio.channels.ByteChannel

   * @return <code>true</code> if this object represents a valid
   * native file handle, <code>false</code> otherwise
   */
  public boolean valid ()
  {
    ByteChannel c = channel;
    return (c != null) && (c.isOpen());
  }
View Full Code Here

Examples of java.nio.channels.ByteChannel

        session.setSelectionKey(ch.register(selector, SelectionKey.OP_READ, session));
    }

    @Override
    protected void destroy(NioSession session) throws Exception {
        ByteChannel ch = session.getChannel();
        SelectionKey key = session.getSelectionKey();
        if (key != null) {
            key.cancel();
        }
        ch.close();
    }
View Full Code Here

Examples of java.nio.channels.ByteChannel

        session.setSelectionKey(ch.register(selector, SelectionKey.OP_READ, session));
    }

    @Override
    protected void destroy(NioSession session) throws Exception {
        ByteChannel ch = session.getChannel();
        SelectionKey key = session.getSelectionKey();
        if (key != null) {
            key.cancel();
        }
        ch.close();
    }
View Full Code Here

Examples of org.tmatesoft.hg.util.ByteChannel

      } else if (revision != null) {
        revToExtract = dataFile.getRevisionIndex(revision);
      } else {
        revToExtract = revisionIndex;
      }
      ByteChannel sinkWrap;
      if (getCancelSupport(null, false) == null) {
        // no command-specific cancel helper, no need for extra proxy
        // sink itself still may supply CS
        sinkWrap = sink;
      } else {
View Full Code Here

Examples of org.tmatesoft.hg.util.ByteChannel

  public void serialize(final DataSerializer out) throws HgIOException, HgRuntimeException {
    final HgIOException failure[] = new HgIOException[1];
    try {
      // TODO #workingCopy API is very limiting, CancelledException is inconvenient,
      // and absence of HgIOException is very uncomfortable
      file.workingCopy(new ByteChannel() {
       
        public int write(ByteBuffer buffer) throws IOException {
          try {
            if (buffer.hasArray()) {
              out.write(buffer.array(), buffer.position(), buffer.remaining());
View Full Code Here

Examples of org.tmatesoft.hg.util.ByteChannel

          throw new CancelledException();
        }
      }
    });
    try {
      cmd.execute(new ByteChannel() {
       
        public int write(ByteBuffer buffer) throws IOException, CancelledException {
          Assert.fail("Shall not get that far provided cancellation from command's CancelSupport is functional");
          return 0;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.