public class PRFileUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
COPYRIGHT |
static java.lang.String |
ENCODING_DOWNLOAD
encoding to use when downloading files
|
static java.lang.String |
ENCODING_EXTRACT
encoding to use when extracting static content
|
static java.lang.String |
ENCODING_ISO
use ISO-8859-1 encoding
|
static java.lang.String |
ENCODING_JAVA
encoding to use with Java files
|
static java.lang.String |
ENCODING_PLATFORM
platform's default encoding
|
static java.lang.String |
ENCODING_UPLOAD
encoding to use when uploading files (ex: Attach)
|
static java.lang.String |
ENCODING_XML
encoding to use with XML files
|
static java.lang.String |
JAVA_ENCODING_EBCDIC
Java encoding name for EBCDIC
|
static java.lang.String |
JAVA_ENCODING_ISO
Java encoding name for ISO
|
static java.lang.String |
JAVA_ENCODING_UTF16BE
Java encoding name for UTF-16 Big Endian
|
static java.lang.String |
JAVA_ENCODING_UTF16LE
Java encoding name for UTF-16 Little Endian
|
static java.lang.String |
JAVA_ENCODING_UTF8
Java encoding name for UTF-8
|
static byte[] |
UTF8_BOM
The UTF-8 byte order mark
|
static java.lang.String |
VERSION |
| Constructor and Description |
|---|
PRFileUtil() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
getBytes(java.io.InputStream aStream,
int aBufferSize)
Reads
aBufferSize number of bytes from the specified InputStream. |
static java.lang.String |
getJavaEncoding(java.lang.String aEncodingType)
Returns the java encoding for the specified encoding type.
|
static java.lang.String |
guessDataContentFileType(java.lang.String aFileName) |
static java.lang.String |
guessEncoding(byte[] aBuffer,
java.lang.String aEncodingType)
Applies heuristics to detect the encoding of the specified byte buffer.
|
static java.lang.String |
guessRuleFileType(java.lang.String aFileName)
Get the class name based on file extension.
|
static java.lang.String |
guessRuleFileType(java.lang.String aFileName,
java.lang.String aFileExtension)
Get the class name based on file extension.
|
static boolean |
hasUTF16BEByteOrderMark(byte[] aBytes)
Indicates that the specified byte array is tagged with a UTF16BE byte order mark.
|
static boolean |
hasUTF16LEByteOrderMark(byte[] aBytes)
Indicates that the specified byte array is tagged with a UTF16LE byte order mark.
|
static boolean |
hasUTF8ByteOrderMark(byte[] aBytes)
Indicates that the specified byte array is tagged with a UTF8 byte order mark.
|
static boolean |
isDataContentCompressible(java.lang.String aDataContentType) |
static java.lang.String |
mapVariantsToJava(java.lang.String aVariant)
Map one of the UTF-8 or ISO-8859-1 variants to the java encoding name - ISO8859_1 or UTF8
|
public static final java.lang.String COPYRIGHT
public static final java.lang.String VERSION
public static final java.lang.String ENCODING_JAVA
public static final java.lang.String ENCODING_UPLOAD
public static final java.lang.String ENCODING_DOWNLOAD
public static final java.lang.String ENCODING_EXTRACT
public static final java.lang.String ENCODING_PLATFORM
public static final java.lang.String ENCODING_ISO
public static final java.lang.String ENCODING_XML
public static final java.lang.String JAVA_ENCODING_ISO
public static final java.lang.String JAVA_ENCODING_EBCDIC
public static final java.lang.String JAVA_ENCODING_UTF8
public static final java.lang.String JAVA_ENCODING_UTF16LE
public static final java.lang.String JAVA_ENCODING_UTF16BE
public static final byte[] UTF8_BOM
public static java.lang.String getJavaEncoding(java.lang.String aEncodingType)
aEncodingType - the encoding typepublic static boolean hasUTF8ByteOrderMark(byte[] aBytes)
aBytes - a byte buffertrue if the specified byte array has a UTF8 byte order markpublic static boolean hasUTF16LEByteOrderMark(byte[] aBytes)
aBytes - a byte buffertrue if the specified byte array has a UTF16LE byte order markpublic static boolean hasUTF16BEByteOrderMark(byte[] aBytes)
aBytes - a byte buffertrue if the specified byte array has a UTF16BE byte order markpublic static java.lang.String guessEncoding(byte[] aBuffer,
java.lang.String aEncodingType)
throws java.io.IOException
aBuffer - a byte bufferaEncodingType - true if the specified byte array has a UTF16BE byte order markjava.io.IOExceptionpublic static byte[] getBytes(java.io.InputStream aStream,
int aBufferSize)
throws java.io.IOException
aBufferSize number of bytes from the specified InputStream.aStream - The stream from which to read the bytesaBufferSize - The number of bytes to read from the stream. If not
specified, aStream.available() bytes are read.InputStreamjava.io.IOExceptionpublic static java.lang.String mapVariantsToJava(java.lang.String aVariant)
aVariant - public static java.lang.String guessRuleFileType(java.lang.String aFileName,
java.lang.String aFileExtension)
aFileExtension - extension of the file to be sent to the browser.aFileName - name of the file without the extension partRule-File-Binary.public static java.lang.String guessRuleFileType(java.lang.String aFileName)
aFileName - name of the file without the extension partRule-File-Binary.public static java.lang.String guessDataContentFileType(java.lang.String aFileName)
public static boolean isDataContentCompressible(java.lang.String aDataContentType)
Copyright © 2014 Pegasystems Inc. All Rights Reserved.