public class DataSourceUtils extends Object
|Constructor and Description|
|Modifier and Type||Method and Description|
Determine the size of the data represented by a
public static long getSize(javax.activation.DataSource ds)
DataSourceobject. The method will try to determine the size without reading the data source. It will do so by looking for the
SizeAwareDataSourceinterface. In addition, it supports some other well known data source implementations for which it is possible to get the size of the data without reading it.
As noted in the documentation of the
SizeAwareDataSource, the returned value
may be an estimation that is not 100% accurate, and code using this method must be prepared
to receive more or less data from the data source.
ds- the data source
-1if the size is unknown
Copyright © The Apache Software Foundation. All Rights Reserved.