public interface SizeAwareDataSource extends DataSource
DataSourceUtils.getSize(DataSource)because this method is able to determine the size of other types of data sources as well.
Code using this interface should be aware that some implementations may be unable to guarantee 100% accuracy when determining the size of the data source. Situations where this can occur include:
readmethods of the
InputStreamclass). It must be prepared to reach the end of the stream after a number of bytes that is lower or higher than the value returned by
DataSource.getInputStream()before reaching the end of the stream. If the implementation is unable to determine the size, it must return -1.
Copyright © The Apache Software Foundation. All Rights Reserved.