dsmiley commented on code in PR #2669: URL: https://github.com/apache/solr/pull/2669#discussion_r1731549604
########## solr/solrj/src/java/org/apache/solr/common/util/BytesOutputStream.java: ########## @@ -22,6 +22,7 @@ import java.io.UnsupportedEncodingException; import java.util.Arrays; +@Deprecated Review Comment: unused ########## solr/core/src/java/org/apache/solr/cli/PostTool.java: ########## @@ -1054,16 +1055,12 @@ public static InputStream stringToStream(String s) { * source and thrown away. */ private static void pipe(InputStream source, OutputStream dest) throws IOException { - byte[] buf = new byte[1024]; - int read = 0; - while ((read = source.read(buf)) >= 0) { - if (null != dest) { - dest.write(buf, 0, read); - } - } - if (null != dest) { - dest.flush(); + if (dest == null) { + dest = NullOutputStream.INSTANCE; Review Comment: A commons-io utility ########## solr/solrj/src/java/org/apache/solr/common/util/Utils.java: ########## @@ -1175,29 +1175,10 @@ public byte[] getbuf() { } } + /** Reads an input stream into a byte array. Does not close the input. */ public static ByteBuffer toByteArray(InputStream is) throws IOException { - return toByteArray(is, Integer.MAX_VALUE); - } - - /** - * Reads an input stream into a byte array - * - * @param is the input stream - * @return the byte array - * @throws IOException If there is a low-level I/O error. - */ - public static ByteBuffer toByteArray(InputStream is, long maxSize) throws IOException { try (BAOS bos = new BAOS()) { - long sz = 0; - int next = is.read(); Review Comment: this code was very sad, reading one char at a time! ########## solr/core/src/java/org/apache/solr/handler/BlobHandler.java: ########## @@ -261,6 +263,16 @@ public void write(OutputStream os) throws IOException { } } + private static InputStream boundedInputStream(final InputStream is, final long maxLength) + throws IOException { + return new BoundedInputStream(is, maxLength) { Review Comment: A commons-io utility -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org