private static int getLength(MAPIType type, InputStream inp) throws IOException { if (type.isFixedLength()) { return type.getLength(); } if (type == Types.ASCII_STRING || type == Types.UNICODE_STRING || type == Types.DIRECTORY || type == Types.BINARY) { // Need to read the length, as it varies return LittleEndian.readInt(inp); } else { throw new IllegalArgumentException("Unknown type " + type); } } private static void skipToBoundary(int length, InputStream inp) throws IOException {
if (!type.isFixedLength()) { isPointer = true; length = 8;