Questions tagged [nio2]

NIO2 is an umbrella name for new features added to the original Java NIO package in the Java 1.7 release. Also referred to as "New I/O".

NIO.2 is an umbrella name for new features added to the original Java package in the Java 1.7 release. Also referred to as "New I/O".

  • Asynchronous Channels and Futures: A Channel that supports asynchronous I/O operations with implementations for sockets, server sockets and files.
  • Completion Handlers: The ability to register handlers that will be called on the completion of an asynchronous I/O event.
  • Asynchronous Channel Groups: A grouping of asynchronous channels for the purpose of resource sharing.
  • Asynchronous Multicast: Support for implementing asynchronous NIO I/O with callbacks for UDP multicast.
  • A New File System API for Java: Defines new interfaces and classes for the Java virtual machine to access files, file attributes, and file systems.

Articles and Tutorials

Note: This tag and wiki should be rolled into the nio tag.

173 questions
0
votes
1 answer

How to deserialize a Serializable object from AsynchronousSocketChannel

To perform a deserialization, I need an ObjectInputStream. But we just use the AsynchronousSocketChannel, which cannot be converted to an ObjectInputStream. What can I do?
Yang Bo
  • 3,586
  • 3
  • 22
  • 35
0
votes
2 answers

Async NIO: Same client sending multiple messages to Server

Regarding Java NIO2. Suppose we have the following to listen to client requests... asyncServerSocketChannel.accept(null, new CompletionHandler () { @Override public void completed(final…
dublintech
  • 16,815
  • 29
  • 84
  • 115
0
votes
2 answers

Java nio2: map Path objects between filesystems without relying on toString

I am creating a zip file from the contents of a source directory using NIO2. I am using a ZipFileSystem, for which I first have to gain an instance, and then generate paths. The generated paths can then be used to create entries in the zip file…
tucuxi
  • 17,561
  • 2
  • 43
  • 74
0
votes
1 answer

nio2 and files attributes

Just downloaded and installed NetBeans NetBeans IDE 7.2 (Build 201207171143); Java: 1.7.0_03; Java HotSpot(TM) Client VM 22.1-b02. This is instead of Eclipse with JDK 6/ The main reason is because I ama starting a new project, that will have to…
-1
votes
1 answer

AsynchronousFileChannel - make sure that close() happens after writes are finished

I have gzip compressor which for the purpose of this question can be seen as a simple buffer. The compressor writes into a NIO2 AsynchronousFileChannel. Once there are enough compressed bytes, the buffer is flushed and an async…
Malt
  • 28,965
  • 9
  • 65
  • 105
-1
votes
1 answer

OpenJDK 7 AsynchronousServerSocketChannel only accepts localhost if bound to localhost/127.0.0.1 not external

> java -version java version "1.7.0_09" OpenJDK Runtime Environment (IcedTea7 2.3.3) (suse-3.16.1-x86_64) OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode) On openSUSE 12.2 (x86_64) and AppArmor is not running, and the firewall is disabled. If…
Display Name
  • 2,323
  • 1
  • 26
  • 45
-2
votes
1 answer

How to make a selection key changed interest op to read/write if a button is clicked?

I have 2 buttons,1 for reading and 1 for writing, how do I make a key to changed interest op to read or write if a button is pressed?
-3
votes
2 answers

recurring check, whether file exists or not

If I would like to check whether file exists or not I will use: File file = new File("name of File"); if(file.exists()) { //do something} But what shall i do, If I would like to use it as check of installation: file can be created e.g. after 5 or…
DRastislav
  • 1,892
  • 3
  • 26
  • 40
1 2 3
11
12