Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
0 votes
0 answers
37 views

The legacy class File (singular) offers the deleteOnExit method to automatically delete a file later, when the JVM exits. 👉🏽 How to do the same in the modern NIO.2 classes? The newer Files (plural) ...
3 votes
0 answers
50 views

When using AsynchronousSocketChannel.write to transmit a message, class Transmitter(channel: AsynchronousSocketChannel) { def transmit(bytes: Array[Byte])(onComplete: Consumer[String]): ...
1 vote
1 answer
709 views

The Files.write & Files.writeString methods in Java 7+ are a concise handy way to write text to a file. try { Files.write ( Paths.get ( "/Users/My_UserName/Example.txt" ) ...
1 vote
0 answers
222 views

How can I get the JDK to perform an atomic move operation, but throw FileAlreadyExistsException if the target already exist ? My source and target are of type Path. I'm guaranteed that they both ...
peterh's user avatar
  • 19.5k
0 votes
1 answer
75 views

If I created a two paths such as: Path path3 = Paths.get("E:\\data"); Path path4 = Paths.get("E:\\user\\home"); And then make a new Path(relativePath) by using the ...
Dean Mouton's user avatar
0 votes
1 answer
190 views

Below program throws "java.nio.file.NoSuchFileException" when subdirecties doesnot exist in path. Could some one please help how can I acheive this ? I want to insert records in asyncronous ...
1 vote
1 answer
2k views

Do you know if it's possible to create Flux of file lines really non-blocking way? The best solution I've found is next: Flux.using( () -> Files.lines(PATH), Flux::fromStream, ...
7 votes
3 answers
436 views

Is the following code thread-safe? If so, what guarantees the safe publication of the ByteBuffer instance to the thread executing the CompletionHandler? AsynchronousSocketChannel channel = ... ...
Malt's user avatar
  • 30.5k
2 votes
1 answer
2k views

Both two method will return stream of data, Is there any different between these two methods? If it's Which way is more suitable to read the large files?
5 votes
0 answers
469 views

I need to connect to 4 machines and read data from sockets. I've chosen to use an async model of nio2. Here is a pseudo-code : class Connector { private final AsynchronousChannelGroup group; ...
flywell's user avatar
  • 386
0 votes
1 answer
1k views

I am trying to implement a highly scalable server in java for the following usecase Client sends a request to server in a form of COMMAND PARAM Server can send a varying size response, from a few ...
5 votes
0 answers
276 views

Recent Windows 10 builds feature an ability to mark a single NTFS directory (not the whole file system) as case sensitive, via fsutil.exe: Per-directory case sensitivity and WSL How to Enable Case ...
4 votes
2 answers
1k views

Why does the method relativize behave differently on java-8 and java-11? Path path1 = Paths.get("/a/./b/../image.png"); Path path2 = Paths.get("/a/file.txt"); Path path = path1....
Nikolas's user avatar
  • 45.1k
0 votes
1 answer
632 views

I'm trying to read the apache2 custom log files in the /var/log/apache2/my_site/access.log in a Java program. But i get a permission denied Excpetion. The code is working on the Winows OS, i can read ...
2 votes
2 answers
662 views

We have underneath method in Java which should delete the source file when its close method is called. private void appendFile(Path destination, Path source) { try (FileChannel sourceChannel = ...

15 30 50 per page
1
2 3 4 5
...
12

AltStyle によって変換されたページ (->オリジナル) /