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 withDataHandlerobjects.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisLargerThan(DataHandler dh, long limit)Check if the givenDataHandlerwill 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 givenDataHandlerwill 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- theDataHandlerto checklimit- the limit- Returns:
trueif the size is larger thanlimit,falseotherwise- Throws:
IOException- ifDataHandler.writeTo(OutputStream)produced an unexpected exception
-
-