I need to specify an OutputStream for an API I\'m using, but I don\'t actually have a need for the output. Does Java have an OutputStream equivale
There is new boy in the town, that takes care of this like a charm, just few lines of code should work. Its JDK 11 and nullWriter() has been introduced there, that takes care of this. Here goes the code to deal with same old problem, new way without worrying about Operating System(OS).
String fileContent = "Welcome to StackOverflow readers !! Here goes the question link...";
Writer writer = Writer.nullWriter();
writer.write(fileContent);
writer.close();
Hope this may help someone!