Update Javadoc of InputStreamResource#contentLength

Closes gh-20990
This commit is contained in:
Rossen Stoyanchev 2020-04-20 12:53:42 +01:00
parent fa5e8485ab
commit 4b85b44bbd
1 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -150,9 +150,11 @@ public abstract class AbstractResource implements Resource {
}
/**
* This implementation reads the entire InputStream to calculate the
* content length. Subclasses will almost always be able to provide
* a more optimal version of this, e.g. checking a File length.
* This method reads the entire InputStream to determine the content length.
* <p>For a custom sub-class of {@code InputStreamResource}, we strongly
* recommend overriding this method with a more optimal implementation, e.g.
* checking File length, or possibly simply returning -1 if the stream can
* only be read once.
* @see #getInputStream()
*/
@Override