File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
spring-core/src/main/java/org/springframework/util Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2022 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
17
17
package org .springframework .util ;
18
18
19
19
import java .io .ByteArrayInputStream ;
20
- import java .io .ByteArrayOutputStream ;
21
20
import java .io .Closeable ;
22
21
import java .io .File ;
23
22
import java .io .IOException ;
@@ -146,9 +145,9 @@ public static byte[] copyToByteArray(@Nullable InputStream in) throws IOExceptio
146
145
return new byte [0 ];
147
146
}
148
147
149
- ByteArrayOutputStream out = new ByteArrayOutputStream ( BUFFER_SIZE );
150
- copy ( in , out );
151
- return out . toByteArray ();
148
+ try ( in ) {
149
+ return in . readAllBytes ( );
150
+ }
152
151
}
153
152
154
153
You can’t perform that action at this time.
0 commit comments