File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
org.springframework.core/src/main/java/org/springframework/core/io Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 25
25
import java .net .URL ;
26
26
27
27
import org .springframework .core .NestedIOException ;
28
- import org .springframework .util .FileCopyUtils ;
29
28
import org .springframework .util .ResourceUtils ;
30
29
31
30
/**
@@ -115,7 +114,22 @@ public File getFile() throws IOException {
115
114
* @see #getInputStream()
116
115
*/
117
116
public long contentLength () throws IOException {
118
- return FileCopyUtils .copyToByteArray (getInputStream ()).length ;
117
+ InputStream is = getInputStream ();
118
+ try {
119
+ long size = 0 ;
120
+ byte [] buf = new byte [255 ];
121
+ for (int read = is .read (buf ); read != -1 ;) {
122
+ size += read ;
123
+ }
124
+ return size ;
125
+ }
126
+ finally {
127
+ try {
128
+ is .close ();
129
+ }
130
+ catch (IOException ex ) {
131
+ }
132
+ }
119
133
}
120
134
121
135
/**
You can’t perform that action at this time.
0 commit comments