net.i2p.servlet.util

## Class ServletUtil

- java.lang.Object
- - net.i2p.servlet.util.ServletUtil

-     public class ServletUtil
      extends Object

  Simple utilities for servlets. Consolidated from i2psnark, susimail, and routerconsole

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `isMobileBrowser(String ua)` The intent here is to return true for phones but false for big tablets? But not consistent.
    `static boolean` | `isSmallBrowser(String ua)`
    `static boolean` | `isTextBrowser(String ua)`
    `static String` | `truncate(String s, int len)` Truncate a String.

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

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

- - ### Method Detail

    - #### isMobileBrowser

          public static boolean isMobileBrowser(String ua)

      The intent here is to return true for phones but false for big tablets? But not consistent.
      Parameters:
        `ua` - User-Agent string, non-null
      Returns:
        true if a mobile browser

    - #### isSmallBrowser

          public static boolean isSmallBrowser(String ua)

      Parameters:
        `ua` - User-Agent string, non-null
      Returns:
        true if a text-mode or mobile browser

    - #### isTextBrowser

          public static boolean isTextBrowser(String ua)

      Parameters:
        `ua` - User-Agent string, non-null
      Returns:
        true if a text-mode browser

    - #### truncate

          public static String truncate(String s,
                                        int len)

      Truncate a String. Same as s.substring(0, len) except that it won't split a surrogate pair or at a ZWJ.
      Parameters:
        `s` - non-null
        `len` - greater than zero
      Returns:
        s if shorter; s.substring(0, len) if the char at len-1 is not a high surrogate or the char at len-1 or len is not a zero-width joiner; s.substring(0, len+1 or len+2) if it is