Package com.adobe.xfa.protocol
Class ProtocolUtils
- java.lang.Object
 - 
- com.adobe.xfa.protocol.ProtocolUtils
 
 
- 
public final class ProtocolUtils extends java.lang.ObjectThis class provides some utility methods to support some protocol I/O capabilities. 
- 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.io.InputStreamcheckUrl(java.lang.String sBaseUrl, java.lang.String sPath, boolean bTrusted, StringHolder sRealUrl)static java.lang.StringgetTemplateBasePathFromConfig(Node contextNode)static java.lang.StringgetTemplateUriPathFromConfig(Node contextNode)static booleanisAbsolute(java.lang.String sPath)static byte[]mimeBoundary(java.lang.String prefix)Generates a MIME boundary string given an optional prefix.static byte[]mimeSection(byte[] boundary, byte[] name, byte[] file, byte[] type, byte[] value)static byte[]mimeTrailer(byte[] boundary)static java.lang.StringnormalizeBaseUrl(java.lang.String sBaseUrl)Normalizes the given base URL.static java.io.InputStreamopenUrl(java.lang.String sUrl)Convenience method for opening an input URL without worrying about all the additional parameters.static intread(java.io.InputStream is, byte[] b)Reads bytes from the input stream into the given array of bytes.static java.lang.StringurlDecode(java.lang.String src)URL decodes the given string.static java.lang.StringurlEncode(java.lang.String src) 
 - 
 
- 
- 
Method Detail
- 
read
public static int read(java.io.InputStream is, byte[] b) throws java.io.IOExceptionReads 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 toInputStream.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:
 java.io.IOException- See Also:
 InputStream.read(byte[])
 
- 
checkUrl
public static java.io.InputStream checkUrl(java.lang.String sBaseUrl, java.lang.String sPath, boolean bTrusted, StringHolder sRealUrl) 
- 
isAbsolute
public static boolean isAbsolute(java.lang.String sPath)
 
- 
normalizeBaseUrl
public static java.lang.String normalizeBaseUrl(java.lang.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 java.io.InputStream openUrl(java.lang.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(java.lang.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 java.lang.String urlEncode(java.lang.String src)
 
- 
urlDecode
public static java.lang.String urlDecode(java.lang.String src)
URL decodes the given string.- Parameters:
 src- the string to decode.- Returns:
 - the decoded string.
 
 
- 
getTemplateBasePathFromConfig
public static java.lang.String getTemplateBasePathFromConfig(Node contextNode)
 
- 
getTemplateUriPathFromConfig
public static java.lang.String getTemplateUriPathFromConfig(Node contextNode)
 
 - 
 
 -