channel « nio « Java I/O Q&A

1. StAX parsing from Java NIO channel

I am attempting to receive a stream of XML events over a Java NIO channel. I am new to both NIO and StAX parsing, so I could very easily be overlooking ...

2. Multi-file gather using selectable file channels

I implemented a multi-file gatherer input stream which is able to read and combine data from previously scattered file segments. However, the current version uses RandomAccessFile along with fixed size ExecutorService, ...

3. Java nio, checking if a channel is ready for read, write

Instead of using a selector in the usual way, where for each ready channel a message can be determined and sent, I'd like to choose whichever connection is currently ready and ...

4. NIO file channel transfer problem on iSeries

I'm having a problem with some Java NIO code running on an iSeries box (JDK 1.5). Basically the code is splitting a file up into chunks part of a file to ...

5. java.nio.channels.*

What is up with nio channels ? There were some nice talks when it was added to java but I still don't see people using it in their applications. Is there something ...

6. java.nio.channels.ClosedChannelException

How can i solve this problem. I got following error: java.nio.channels.ClosedChannelException This is coding:

 public void run() {

    try {


7. BinaryStreams-like helper classes for NIO Channels?

Is there a library for NIO ByteChannel providing similar utilities to what google-guava and commons-io provide for streams? E.g. I'd like to have several ReadableByteChannels concatenated in one or have a ...

8. java nio selector & channel usage problem

i am really puzzled with java nio,


import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.util.Iterator;
import java.util.Set;

public class MySelector {
    public static void main(String[] args) throws IOException {

9. Apply an FilterInputStream to a Channel

How can I apply a FilterInputStream to an NIO Channel, specifically a FileChannel obtained from a RandomAccessFile?

10. What is the difference between write and send on NIO channels?

I'm building a UDP communication system with Java NIO, and browsing through the javadoc for the APIs I noticed that channels have a write primitive and a send primitive. I have ...

12. How to recieve Objects using NIO Channels?

Hi, How is it possible to send objects thru NIO channels? ..... I am having problems recieving objects using NIO channels. In my program i am sending an object using the ObjectOutputStream ..... and at the server i am using the SocketChannel read(ByteBuffer bb) , method .... now i tried the Following --------------------------------------------------- SocketChannel sc; /// this is the socket channel ...

13. programming

hi This is sathish i want some programs on socket channel programming by using java.nio.channels package what exactly i want is a client program a server program client should able to send some messgae to server. soon after recieving the message from the client , server should send the same message and client should be able to see it thanks

14. NIO Channel -Object Transfer

Hi, i was trying this test code given below, for transfer of objects thru NIO Channels.. Everything working fine but at the point when i try to create a ObjectOutputStream ...using the SocketChannel ... i get an error saying ::-> java.nio.channels.IllegalBlockingModeException . i really dont understand why this happens ... is there any thing wrong that i am doin?..... Please Help ...

16. Can I make Nio Channels non-interupptible ?

I am writing modification to a series of files in turn using a FileChannel to make modifications to a file. I am trying to improve the performance of the code by multithreading it. But if a thread is interuppted (due to user cancelling task) whilst writing the the file it closes the FIleChannel, because nio is interuptible. I would rather an ...

17. open more than one selectors in one system?

Hi, the is in a few words used to multiplex (communication) channels. It is also based on an (single) underlying low-level UNIX operating system entity. All these give me the impression, that there is no reason to "open" more than one selectors -multiplexing (server) socket channels, in my case- on a single system. Is this true? Would the only reason ...

18. java.nio.channels.NotYetConnectedException causing me some trouble

Hi guys, I wrote a multi-threaded c/s application using NIO - i have 1. An acceptor thread for accepting new clients (handleAccpet) and adding them to a queue 2. Few worker threads that use handleRead and handleWrite, contains a queue for clients to register In the accpetor thread i only do .accept() and i'm not registering the channel on the selector, ...