File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
utils/src/main/java/datadog/instrument/utils Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -72,14 +72,18 @@ public static byte[] readAllBytes(InputStream is) throws IOException {
7272 if (JVM .atLeastJava (9 )) {
7373 return is .readAllBytes ();
7474 } else {
75- try (ByteArrayOutputStream os = new ByteArrayOutputStream ()) {
76- int bytesRead ;
77- byte [] buf = new byte [BUFFER_SIZE ];
78- while ((bytesRead = is .read (buf , 0 , BUFFER_SIZE )) != -1 ) {
79- os .write (buf , 0 , bytesRead );
80- }
81- return os .toByteArray ();
75+ return readAllBytesLoop (is );
76+ }
77+ }
78+
79+ private static byte [] readAllBytesLoop (InputStream is ) throws IOException {
80+ try (ByteArrayOutputStream os = new ByteArrayOutputStream ()) {
81+ int bytesRead ;
82+ byte [] buf = new byte [BUFFER_SIZE ];
83+ while ((bytesRead = is .read (buf , 0 , BUFFER_SIZE )) != -1 ) {
84+ os .write (buf , 0 , bytesRead );
8285 }
86+ return os .toByteArray ();
8387 }
8488 }
8589}
You can’t perform that action at this time.
0 commit comments