Questions tagged [java-nio]

Use the tag for questions related with the Java package java.nio

Java Package java.nio defines buffers, which are containers for data, and provides an overview of the other NIO packages.

Oracle java-nio Package Description

39 questions
0
votes
1 answer

How to filter Java Streams using Files.getAttribute

I am trying to filter files that were created more recent than another file. I just don't get how to apply the methods from Files directly to the stream. Is there a neater way to do it?, I know it does not help readability to use Streams for the…
0
votes
0 answers

How does this NIO read work under the hood?

I am new to reactive programming and I am reading Reactive Spring by Josh Long. In Chapter 4 he introduces a small program to show how a non-blocking file read actually works. package rsb.io; import lombok.extern.log4j.Log4j2; import…
ng.newbie
  • 2,807
  • 3
  • 23
  • 57
0
votes
0 answers

Should I use JavaNIO to pass file references to Saxon s9api?

I downloaded the Saxon 10 samples from the Saxonica website to get some examples on how to use the s9api. I found all samples using the classic java.io.* classes to read and write files for the XSL transformation. I then tried to find any Saxon…
burki
  • 6,741
  • 1
  • 15
  • 31
0
votes
1 answer

NullPointer Exception when mocking java.nio.Files.class

I am trying to write a unit test for the class: public class ClassToTest { public List walk(URI path) { List directories= new List(); Path share = Paths.get(path); try { …
Shubham
  • 98
  • 1
  • 11
-1
votes
1 answer

how to create absolute path from absolute and relative one?

I write a simple application on kotlin and I encountered the next problem: I have relative (../../) and absolute (a/b/c) paths. I want to get path a/ . How to accomplish that without dancing with strings? Maybe there are methods in java/kotlin which…
Nikolai
  • 19
  • 3
-1
votes
1 answer

Java NIO - Channel attachment is pass by value or reference?

I am in the process of learning Java NIO APIs and was able to understand how things work except attachment object. As far as I understand, we can create channels like socketChannels and attach an object to them. Whenever there is an event on a given…
voila
  • 1,594
  • 2
  • 19
  • 38
-2
votes
1 answer

Get Linux file descriptor of FileChannel

Is there a way to get the Linux file descriptor for an opened FileChannel? I need it to call mount.fuse -o fd=... (for implementing FUSE). As a hacky workaround, I'm doing: var pid = ProcessHandle.current().pid(); var fd =…
Aleksandr Dubinsky
  • 22,436
  • 15
  • 82
  • 99
-2
votes
1 answer

Use cases OutputStream(java.io) vs Channel(java.nio)

Did i right understand, what Channel used for cases, when data, which we want to write - is not full received/prepared data? But OutputStream used for case when we can write all data already now. Another words: nio - when we asynchronous getting…
GreenFed
  • 57
  • 2
  • 7
-3
votes
1 answer

Is BufferedReader.readLine method non-blocking

I was using Java NIO Files.lines method but i was curious to know the code so dig little bit further then i see some FileChannel of nio package. my digging took me to buffered reader it seems like there nio is using io which is supposed to be…
Muhammad Ilyas
  • 200
  • 2
  • 12
1 2
3