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
Post a Comment