Package org.apache.axiom.util.activation
Class DataSourceUtils
- java.lang.Object
-
- org.apache.axiom.util.activation.DataSourceUtils
-
public class DataSourceUtils extends Object
Contains utility methods to work withDataSource
objects.
-
-
Constructor Summary
Constructors Constructor Description DataSourceUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
getSize(DataSource ds)
Determine the size of the data represented by aDataSource
object.
-
-
-
Method Detail
-
getSize
public static long getSize(DataSource ds)
Determine the size of the data represented by aDataSource
object. The method will try to determine the size without reading the data source. It will do so by looking for theSizeAwareDataSource
interface. 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.- Parameters:
ds
- the data source- Returns:
- (an estimation of) the size of the data or
-1
if the size is unknown
-
-