<div>Hi,</div><div> </div><div>I've noticed that in most of the code outside of JDK an InputStream taken from FileURLConnection is either read entirely e.g.</div><div>in ASM's ClassLoader or passed into Properties where it's read with LineReader (which itself has an internal buffer).</div><div> </div><div>Apart from mark/reset activity we need buffering for InputStreams only in case when we read byte by byte which happens seldom</div><div>unlike reading with read(byte[], int, int).</div><div> </div><div>As soon as BufferedInputStream() allocates its buffer eagerly this means waisting 8 kB of memory per each instance and executing</div><div>redundant redundant code involving interaction with volatiles.</div><div> </div><div>So my suggestion is to stop wrapping of InputStream with BufferedInputStream from FileURLConnection along</div><div>specify explicitly in JavaDoc that an InputStream returned from FileURLConnection.getInputStream() is not buffered</div><div>as it is done in Files.newInputStream().</div><div> </div><div>Regards,</div><div>Sergey Tsypanov</div>