Top "Nio" questions

NIO is Java 'New I/O' introduced in 1.4, providing non-blocking and multiplexed network I/O; 'direct' (native) buffers; file locks and mapped files; and character set codecs.

Java NIO: How to know when SocketChannel read() is complete with non-blocking I/O

I am currently using a non-blocking SocketChannel (Java 1.6) to act as a client to a Redis server. Redis accepts plain-text …

java nio nonblocking socketchannel
How should I use AsynchronousServerSocketChannel for accepting connections?

I would like to write an asynchronous server using Java 7 and NIO 2. But how should I use AsynchronousServerSocketChannel? E.g. …

java asynchronous nio java-7
Java NIO. SocketChannel.read method all time return 0. Why?

I try understand how works java NIO. In particular, how works SocketChannel. I wrote code below: import java.io.*; import …

java sockets nio socketchannel
How do Jetty and other containers leverage NIO while sticking to the Servlet specification?

I'm new to NIO, and I am trying to figure out how Jetty leverages NIO. My understanding of how traditional …

java servlets jetty nio nonblocking
Why the odd performance curve differential between ByteBuffer.allocate() and ByteBuffer.allocateDirect()

I'm working on some SocketChannel-to-SocketChannel code which will do best with a direct byte buffer--long lived and large (tens to …

java nio bytebuffer
How correctly close SocketChannel in Java NIO?

I have a simple non-blocking server with main loop: try { while (selector.select() > -1) { // Wait for an event one …

java nio socketchannel
Using JAVA NIO framework in SPRING server

I'm implementing an hybrid server application that mixes a Web-Servlet and a plain Java application. The java application manages thousands …

java spring netty nio apache-mina
Read lines of characters and get file position

I'm reading sequential lines of characters from a text file. The encoding of the characters in the file might not …

java nio java-io
Using java file locks within single JVM and across multiple JVMs

I guess I miss something, but I cannot understand how file locks work in Java. To be more exact - …

java nio file-locking
Making file transfer more efficient Java

I have two wireless computers connected to an N wireless router. Each of these PCs are connected at between 108-150…

java sockets networking nio file-transfer