vert.x - Read large file using vertx -


i new using vertx , using vertx filesystem api read file of large size.

vertx.filesystem().readfile("target/classes/readme.txt", result -> {     if (result.succeeded()) {         system.out.println(result.result());     } else {         system.err.println("oh oh ..." + result.cause());     } }); 

but ram consumed while reading , resource not flushed after use. vertx filesystem api suggest do not use method read large files or risk running out of available ram.

is there alternative this?

the reason internally .readfile calls files.readallbytes.

what should instead create stream out of file, , pass vertx handler:

    try (inputstream steam = new fileinputstream("target/classes/readme.txt")) {         // handling here     } 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -