File read/write in single line no libraries

Simple single line of Java without any library dependencies to read a file into a String and write a String to a file.

Read file into String

new String(Files.readAllBytes(Paths.get(filename)));


Write String to file

Files.write(Paths.get(filename), someString.getBytes());

Comments

Popular posts from this blog

Sites, Newsletters, and Blogs

Oracle JDBC ReadTimeout QueryTimeout