Class ProtocolUtils

java.lang.Object
com.adobe.xfa.protocol.ProtocolUtils

public final class ProtocolUtils extends Object
This class provides some utility methods to support some protocol I/O capabilities.
  • Method Details

    • read

      public static int read(InputStream is, byte[] b) throws IOException
      Reads bytes from the input stream into the given array of bytes. This method blocks until all input data is available, end of file is detected, or an exception is thrown. Contrary to InputStream.read(byte[]), this method will block until a full buffer's worth of data is read.
      Parameters:
      b - the buffer into which the data is read.
      Returns:
      the number of bytes read, or -1 when end of the stream has been reached.
      Throws:
      IOException
      See Also:
    • checkUrl

      public static InputStream checkUrl(String sBaseUrl, String sPath, boolean bTrusted, StringHolder sRealUrl)
    • isAbsolute

      public static boolean isAbsolute(String sPath)
    • normalizeBaseUrl

      public static String normalizeBaseUrl(String sBaseUrl)
      Normalizes the given base URL. Base URLs are those from which relative URIs can be resolved.
      Parameters:
      sBaseUrl - a base URL.
    • openUrl

      public static InputStream openUrl(String sUrl)
      Convenience method for opening an input URL without worrying about all the additional parameters.
      Parameters:
      sUrl - Name of resource to open. This may be a local file or a remote location.
      Returns:
      Input stream corresponding to the URL opened; null if the operation fails.
    • mimeBoundary

      public static byte[] mimeBoundary(String prefix)
      Generates a MIME boundary string given an optional prefix.
    • mimeSection

      public static byte[] mimeSection(byte[] boundary, byte[] name, byte[] file, byte[] type, byte[] value)
    • mimeTrailer

      public static byte[] mimeTrailer(byte[] boundary)
    • urlEncode

      public static String urlEncode(String src)
    • urlDecode

      public static String urlDecode(String src)
      URL decodes the given string.
      Parameters:
      src - the string to decode.
      Returns:
      the decoded string.
    • getTemplateBasePathFromConfig

      public static String getTemplateBasePathFromConfig(Node contextNode)
    • getTemplateUriPathFromConfig

      public static String getTemplateUriPathFromConfig(Node contextNode)