Skip to content

Commit e5a3c43

Browse files
committed
Merge branch '6.2.x'
2 parents efea289 + db5809f commit e5a3c43

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

spring-core/src/main/java/org/springframework/util/StreamUtils.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,12 +27,12 @@
2727

2828
import org.jspecify.annotations.Nullable;
2929

30-
import org.springframework.lang.Contract;
31-
3230
/**
33-
* Simple utility methods for dealing with streams. The copy methods of this class are
34-
* similar to those defined in {@link FileCopyUtils} except that all affected streams are
35-
* left open when done. All copy methods use a block size of 8192 bytes.
31+
* Simple utility methods for dealing with streams.
32+
*
33+
* <p>The copy methods of this class are similar to those defined in
34+
* {@link FileCopyUtils} except that all affected streams are left open when done.
35+
* All copy methods use a block size of {@value #BUFFER_SIZE} bytes.
3636
*
3737
* <p>Mainly for use within the framework, but also useful for application code.
3838
*
@@ -191,14 +191,14 @@ public static long copyRange(InputStream in, OutputStream out, long start, long
191191
}
192192

193193
/**
194-
* Drain the remaining content of the given InputStream.
195-
* <p>Leaves the InputStream open when done.
196-
* @param in the InputStream to drain
197-
* @return the number of bytes read
194+
* Drain the remaining content of the given {@link InputStream}.
195+
* <p>Leaves the {@code InputStream} open when done.
196+
* @param in the {@code InputStream} to drain
197+
* @return the number of bytes read, or {@code 0} if the supplied
198+
* {@code InputStream} is {@code null} or empty
198199
* @throws IOException in case of I/O errors
199200
* @since 4.3
200201
*/
201-
@Contract("null -> fail")
202202
public static int drain(@Nullable InputStream in) throws IOException {
203203
if (in == null) {
204204
return 0;

0 commit comments

Comments
 (0)