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 with `DataHandler` objects.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static boolean` | `isLargerThan​(DataHandler dh, long limit)` | Check if the given `DataHandler` will produce a byte stream that is longer than a given limit.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### isLargerThan

          public static boolean isLargerThan​(DataHandler dh,
                                             long limit)
                                      throws IOException

      Check if the given `DataHandler` will produce a byte stream that is longer than a given limit. It will first attempt to determine the size using `DataSourceUtils.getSize(DataSource)`. If that fails, it will use `DataHandler.writeTo(OutputStream)` to determine if the size is larger than the limit.
      Parameters:
        `dh` - the `DataHandler` to check
        `limit` - the limit
      Returns:
        `true` if the size is larger than `limit`, `false` otherwise
      Throws:
        `IOException` - if `DataHandler.writeTo(OutputStream)` produced an unexpected exception