Package org.apache.axiom.util.activation
Class DataHandlerUtils
- java.lang.Object
-
- org.apache.axiom.util.activation.DataHandlerUtils
-
public final class DataHandlerUtils extends Object
Contains utility methods to work withDataHandler
objects.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isLargerThan(DataHandler dh, long limit)
Check if the givenDataHandler
will produce a byte stream that is longer than a given limit.
-
-
-
Method Detail
-
isLargerThan
public static boolean isLargerThan(DataHandler dh, long limit) throws IOException
Check if the givenDataHandler
will produce a byte stream that is longer than a given limit. It will first attempt to determine the size usingDataSourceUtils.getSize(DataSource)
. If that fails, it will useDataHandler.writeTo(OutputStream)
to determine if the size is larger than the limit.- Parameters:
dh
- theDataHandler
to checklimit
- the limit- Returns:
true
if the size is larger thanlimit
,false
otherwise- Throws:
IOException
- ifDataHandler.writeTo(OutputStream)
produced an unexpected exception
-
-