public class VariantSupport extends Variant
FIXME (3): Reading and writing should be made more uniform than it is now. The following items should be resolved:
Modifier and Type | Field and Description |
---|---|
static int[] |
SUPPORTED_TYPES
HPSF is able to read these
Variant types.
(HPSF 能够读取这些 Variant 类型。)
|
LENGTH_0, LENGTH_2, LENGTH_4, LENGTH_8, LENGTH_UNKNOWN, LENGTH_VARIABLE, VT_ARRAY, VT_BLOB, VT_BLOB_OBJECT, VT_BOOL, VT_BSTR, VT_BYREF, VT_CARRAY, VT_CF, VT_CLSID, VT_CY, VT_DATE, VT_DECIMAL, VT_DISPATCH, VT_EMPTY, VT_ERROR, VT_FILETIME, VT_HRESULT, VT_I1, VT_I2, VT_I4, VT_I8, VT_ILLEGAL, VT_ILLEGALMASKED, VT_INT, VT_LPSTR, VT_LPWSTR, VT_NULL, VT_PTR, VT_R4, VT_R8, VT_RESERVED, VT_SAFEARRAY, VT_STORAGE, VT_STORED_OBJECT, VT_STREAM, VT_STREAMED_OBJECT, VT_TYPEMASK, VT_UI1, VT_UI2, VT_UI4, VT_UI8, VT_UINT, VT_UNKNOWN, VT_USERDEFINED, VT_VARIANT, VT_VECTOR, VT_VERSIONED_STREAM, VT_VOID
Constructor and Description |
---|
VariantSupport() |
Modifier and Type | Method and Description |
---|---|
static boolean |
isLogUnsupportedTypes()
Checks whether logging of unsupported variant types warning is turned on or off.
(检查是否打开或关闭不支持的变体类型警告的日志记录。)
|
boolean |
isSupportedType(int variantType)
Checks whether HPSF supports the specified variant type.
(检查 HPSF 是否支持指定的变体类型。)
|
static java.lang.Object |
read(byte[] src, int offset, int length, long type, int codepage)
Reads a variant type from a byte array.
(从字节数组中读取变体类型。)
|
static java.lang.Object |
read(LittleEndianByteArrayInputStream lei, int length, long type, int codepage) |
static void |
setLogUnsupportedTypes(boolean logUnsupportedTypes)
Specifies whether warnings about unsupported variant types are to be written to
System.err or not.
(指定是否将有关不受支持的变体类型的警告写入 System.err。)
|
static int |
write(java.io.OutputStream out, long type, java.lang.Object value, int codepage)
Writes a variant value to an output stream.
(将变量值写入输出流。)
|
protected static void |
writeUnsupportedTypeMessage(UnsupportedVariantTypeException ex)
Writes a warning to
System.err that a variant type is unsupported by HPSF.
(向 System.err 写入 HPSF 不支持变体类型的警告。)
|
getVariantLength, getVariantName
public static final int[] SUPPORTED_TYPES
Variant
types.
(HPSF 能够读取这些 Variant 类型。)
public static void setLogUnsupportedTypes(boolean logUnsupportedTypes)
System.err
or not.
(指定是否将有关不受支持的变体类型的警告写入 System.err。)
logUnsupportedTypes
- If
true
warnings will be written, if
false
they won't.
(logUnsupportedTypes - 如果将写入 true 警告,如果 false 则不会。)
public static boolean isLogUnsupportedTypes()
true
if logging is turned on, else
false
.
(如果日志记录已打开,则为 true,否则为 false。)
protected static void writeUnsupportedTypeMessage(UnsupportedVariantTypeException ex)
System.err
that a variant type is unsupported by HPSF. Such a warning is written only once for each variant type. Log messages can be turned on or off by
(向 System.err 写入 HPSF 不支持变体类型的警告。对于每种变体类型,此类警告仅写入一次。日志消息可以通过以下方式打开或关闭)
ex
- The exception to log
(ex - 记录的异常)
public boolean isSupportedType(int variantType)
SUPPORTED_TYPES
array.
(检查 HPSF 是否支持指定的变体类型。不支持的类型应包含在 SUPPORTED_TYPES 数组中。)
variantType
- the variant type to check
(variantType - 要检查的变体类型)
true
if HPFS supports this type, else
false
(如果 HPFS 支持此类型,则为 true,否则为 false)
Variant
public static java.lang.Object read(byte[] src, int offset, int length, long type, int codepage) throws ReadingNotSupportedException, java.io.UnsupportedEncodingException
src
- The byte array
(src - 字节数组)
offset
- The offset in the byte array where the variant starts
(offset - 变体开始的字节数组中的偏移量)
length
- The length of the variant including the variant type field
(length - 变体的长度,包括变体类型字段)
type
- The variant type to read
(type - 要读取的变体类型)
codepage
- The codepage to use for non-wide strings
(codepage - 用于非宽字符串的代码页)
Long
, a VT_LPSTR as a
String
.
(与变量字段最对应的 Java 对象。例如,VT_I4 作为 Long 返回,VT_LPSTR 作为 String 返回。)
ReadingNotSupportedException
- if a property is to be written who's variant type HPSF does not yet support
(ReadingNotSupportedException - 如果要写入 HPSF 尚不支持的变体类型的属性)
java.io.UnsupportedEncodingException
- if the specified codepage is not supported.
(java.io.UnsupportedEncodingException - 如果指定的代码页不受支持。)
Variant
public static java.lang.Object read(LittleEndianByteArrayInputStream lei, int length, long type, int codepage) throws ReadingNotSupportedException, java.io.UnsupportedEncodingException
ReadingNotSupportedException
(ReadingNotSupportedException)
java.io.UnsupportedEncodingException
(java.io.UnsupportedEncodingException)
public static int write(java.io.OutputStream out, long type, java.lang.Object value, int codepage) throws java.io.IOException, WritingNotSupportedException
out
- The stream to write the value to.
(out - 要将值写入的流。)
type
- The variant's type.
(type - 变体的类型。)
value
- The variant's value.
(value - 变体的值。)
codepage
- The codepage to use to write non-wide strings
(codepage - 用于编写非宽字符串的代码页)
java.io.IOException
- if an I/O exceptions occurs
(java.io.IOException - 如果发生 I/O 异常)
WritingNotSupportedException
- if a property is to be written who's variant type HPSF does not yet support
(WritingNotSupportedException - 如果要写入其变体类型 HPSF 尚不支持的属性)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.