|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.poi.hpsf.Variant org.apache.poi.hpsf.VariantSupport
public class VariantSupport
Supports reading and writing of variant data.
FIXME (3): Reading and writing should be made more uniform than it is now. The following items should be resolved:
Field Summary | |
---|---|
static int[] |
SUPPORTED_TYPES
HPSF is able to read these Variant types. |
Fields inherited from class org.apache.poi.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 Summary | |
---|---|
VariantSupport()
|
Method Summary | |
---|---|
static java.lang.String |
codepageToEncoding(int codepage)
Deprecated. POI 3.16 - use CodePageUtil.codepageToEncoding(int) |
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. |
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. |
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. |
Methods inherited from class org.apache.poi.hpsf.Variant |
---|
getVariantLength, getVariantName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int[] SUPPORTED_TYPES
Variant
types.
Constructor Detail |
---|
public VariantSupport()
Method Detail |
---|
public static void setLogUnsupportedTypes(boolean logUnsupportedTypes)
System.err
or not.
logUnsupportedTypes
- If true
warnings will be written,
if false
they won't.public static boolean isLogUnsupportedTypes()
true
if logging is turned on, else
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
ex
- The exception to logpublic boolean isSupportedType(int variantType)
SUPPORTED_TYPES
array.
variantType
- the variant type to check
true
if HPFS supports this type, else
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 arrayoffset
- The offset in the byte array where the variant startslength
- The length of the variant including the variant type fieldtype
- The variant type to readcodepage
- The codepage to use for non-wide strings
Long
, a VT_LPSTR as a
String
.
ReadingNotSupportedException
- if a property is to be written
who's variant type HPSF does not yet support
java.io.UnsupportedEncodingException
- if the specified codepage is not
supported.Variant
public static java.lang.Object read(LittleEndianByteArrayInputStream lei, int length, long type, int codepage) throws ReadingNotSupportedException, java.io.UnsupportedEncodingException
ReadingNotSupportedException
java.io.UnsupportedEncodingException
@Deprecated @Removal(version="3.18") public static java.lang.String codepageToEncoding(int codepage) throws java.io.UnsupportedEncodingException
CodePageUtil.codepageToEncoding(int)
codepage
- The codepage number
java.io.UnsupportedEncodingException
- if the specified codepage is
less than zero.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.type
- The variant's type.value
- The variant's value.codepage
- The codepage to use to write non-wide strings
java.io.IOException
- if an I/O exceptions occurs
WritingNotSupportedException
- if a property is to be written
who's variant type HPSF does not yet support
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |