List of usage examples for org.apache.poi.util LittleEndian getUShort
public static int getUShort(byte[] data, int offset)
From source file:com.duroty.lucene.parser.MSPowerPointParser.java
License:Open Source License
/** * DOCUMENT ME!/* ww w . j a va 2s. co m*/ * * @param event DOCUMENT ME! */ public void processPOIFSReaderEvent(POIFSReaderEvent event) { try { if (!event.getName().equalsIgnoreCase("PowerPoint Document")) { return; } DocumentInputStream input = event.getStream(); byte[] buffer = new byte[input.available()]; input.read(buffer, 0, input.available()); byte[] espace = new String("\n\n").getBytes(); for (int i = 0; i < (buffer.length - 20); i++) { long type = LittleEndian.getUShort(buffer, i + 2); long size = LittleEndian.getUInt(buffer, i + 4); if (type == 4008) { writer.write(buffer, i + 4 + 1, (int) size + 3); writer.write(espace); i = (i + 4 + 1 + (int) size) - 1; } /*if (sleep > 0) { try { Thread.sleep(sleep); } catch (Exception ex) { } }*/ } } catch (Exception ex) { } }
From source file:com.flexive.extractor.PowerpointExtractor.java
License:Open Source License
private void processContent(byte[] buffer, int beginIndex, int endIndex) { while (beginIndex < endIndex) { int containerFlag = LittleEndian.getUShort(buffer, beginIndex); int recordType = LittleEndian.getUShort(buffer, beginIndex + 2); long recordLength = LittleEndian.getUInt(buffer, beginIndex + 4); beginIndex += 8;//from w w w. ja va2s.com if ((containerFlag & 0x0f) == 0x0f) { processContent(buffer, beginIndex, beginIndex + (int) recordLength); } else if (recordType == 4008) { writer.write(buffer, beginIndex, (int) recordLength); writer.write(' '); } beginIndex += (int) recordLength; } }
From source file:lius.index.powerpoint.PPTIndexer.java
License:Apache License
public void processPOIFSReaderEvent(POIFSReaderEvent event) { try {//from w ww .j a va2s . co m if (!event.getName().equalsIgnoreCase("PowerPoint Document")) return; DocumentInputStream input = event.getStream(); byte[] buffer = new byte[input.available()]; input.read(buffer, 0, input.available()); for (int i = 0; i < buffer.length - 20; i++) { long type = LittleEndian.getUShort(buffer, i + 2); long size = LittleEndian.getUInt(buffer, i + 4); if (type == 4008L) { writer.write(buffer, i + 4 + 1, (int) size + 3); i = i + 4 + 1 + (int) size - 1; } } } catch (Exception ex) { logger.error(ex.getMessage()); } }
From source file:net.sf.mmm.content.parser.impl.poi.ContentParserPpt.java
License:Apache License
/** * /*from w ww. j a v a 2s.c om*/ * @param buffer * @param offset * @param length * @param textBuffer * @throws UnsupportedEncodingException */ private void extractRecursive(byte[] buffer, int offset, int length, StringBuffer textBuffer) throws UnsupportedEncodingException { int offsetLength = offset + length - 8; if (offsetLength > buffer.length - 8) { /* * System.out.println("Illegal array index: offset=" + offset + ", * length=" + length + ", bufferSize=" + buffer.length); */ offsetLength = buffer.length - 8; } int index = offset; while (index < offsetLength) { // int info = LittleEndian.getUShort(buffer, index + // PPT_RECORD_INFO_OFFSET); int type = LittleEndian.getUShort(buffer, index + PPT_RECORD_TYPE_OFFSET); long longSize = LittleEndian.getUInt(buffer, index + PPT_RECORD_SIZE_OFFSET); // System.out.println("Index is: " + index); // System.out.println("record info: " + info); // System.out.println("record type: " + type); // System.out.println("record size: " + longSize); int size = (int) longSize; if (size < 0) { // System.out.println("size truncated: " + longSize + ""); return; } index += PPT_RECORD_LENGTH; if (type == PPT_TYPE_SLIDE_LIST_WITH_TEXT) { extractRecursive(buffer, index, size, textBuffer); } else if (type == PPT_TYPE_HEADER_FOOTER) { extractRecursive(buffer, index, size, textBuffer); } else if (type == PPT_TYPE_DOCUMENT) { extractRecursive(buffer, index, size, textBuffer); } else if (type == PPT_TYPE_SLIDE) { // extractRecursive(buffer, index, size, textBuffer); } else if (type == PPT_TYPE_MAIN_MASTER) { // extractRecursive(buffer, index, size, textBuffer); } else if (type == PPT_TYPE_CHAR_STRING) { String text = new String(buffer, index, size, ENCODING_UTF16LE); textBuffer.append(text); textBuffer.append('\n'); } else if (type == PPT_TYPE_TEXT_BYTES_ATOM) { String text = new String(buffer, index, size); textBuffer.append(text); textBuffer.append('\n'); } else if (type == PPT_TYPE_TEXT_CHARS_ATOM) { String text = new String(buffer, index, size, ENCODING_UTF16LE); textBuffer.append(text); textBuffer.append('\n'); } else if (type == PPT_TYPE_NOTES) { // --> PPT_TYPE_DRAWING extractRecursive(buffer, index, size, textBuffer); } else if (type == PPT_TYPE_DRAWING) { // --> PPT_TYPE_ESCHER_DG_CONTAINER extractRecursive(buffer, index, size, textBuffer); } else if (type == PPT_TYPE_ESCHER_DG_CONTAINER) { // --> PPT_TYPE_ESCHER_SPGR_CONTAINER extractRecursive(buffer, index, size, textBuffer); } else if (type == PPT_TYPE_ESCHER_SPGR_CONTAINER) { // --> PPT_TYPE_ESCHER_SP_CONTAINER extractRecursive(buffer, index, size, textBuffer); } else if (type == PPT_TYPE_ESCHER_SP_CONTAINER) { // --> PPT_TYPE_ESCHER_TEXTBOX extractRecursive(buffer, index, size, textBuffer); } else if (type == PPT_TYPE_ESCHER_TEXTBOX) { // --> PPT_TYPE_TEXT_BYTES_ATOM extractRecursive(buffer, index, size, textBuffer); /* * } else if (type == PPT_TYPE_DOCUMENT_ATOM) { // ignore } else if * (type == PPT_TYPE_SLIDE_ATOM) { // ignore } else if (type == * PPT_TYPE_NOTES_ATOM) { // ignore } else if (type == * PPT_TYPE_ENVIRONMENT) { // ignore } else if (type == * PPT_TYPE_SLIDE_PERSIST_ATOM) { // ignore } else if (type == * PPT_TYPE_EXTENDED_OBJECT_LIST) { // ignore } else if (type == * PPT_TYPE_DRAWING_GROUP) { // ignore } else if (type == * PPT_TYPE_ESCHER_DG) { // ignore } else if (type == * PPT_TYPE_INTERACTIVE_INFO) { // ignore } else if (type == * PPT_TYPE_HEADER_FOOTER_ATOM) { // ignore } else if (type == * PPT_TYPE_SPEC_INFO_ATOM) { // ignore } else if (type == * PPT_TYPE_STYLE_TEXT_PROPERTY_ATOM) { // ignore } else if (type == * PPT_TYPE_SLIDE_ATOM) { // ignore } else if (type == * PPT_TYPE_SLIDE_PERSIST_ATOM) { // ignore } else if (type == * PPT_TYPE_SLIDE_PERSIST_ATOM) { // ignore } else if (type == * PPT_TYPE_TEXT_HEADER_ATOM) { // ignore } else if (type == * PPT_TYPE_TX_INTERACTIVE_INFO_ATOM) { // ignore */ } index += size; } }
From source file:org.apache.nutch.parse.mspowerpoint.ContentReaderListener.java
License:Apache License
/** * Reads the internal PowerPoint document stream. * //from www .j ava 2 s.com * @see org.apache.poi.poifs.eventfilesystem.POIFSReaderListener#processPOIFSReaderEvent(org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent) */ public void processPOIFSReaderEvent(final POIFSReaderEvent event) { if (event == null || event.getName() == null || !event.getName().startsWith(PPTConstants.POWERPOINT_DOCUMENT)) { if (LOG.isWarnEnabled()) { LOG.warn("Stream not processed. It is not a PowerPoint document: : " + event.getName()); } return; } try { final DocumentInputStream dis = event.getStream(); final byte pptdata[] = new byte[dis.available()]; dis.read(pptdata, 0, dis.available()); int offset = 0; long offsetPD = 0; /* * Traverse Bytearray to get CurrentUserEditAtom Call to extract the Text * in all PlaceHolders to hold PPTClientTextBox objects for mapping into * Slide Objects */ Hashtable/* <Long, TextBox> */ containerTextBox = new Hashtable/* * <Long, * TextBox> */(); // Traverse ByteArray to identiy edit paths of ClientTextBoxes long n = pptdata.length - 20; for (long i = 0; i < n; i++) { final long type = LittleEndian.getUShort(pptdata, (int) i + 2); // final long size = LittleEndian.getUInt(pptdata, (int) i + 4); if (PPTConstants.PPT_ATOM_USEREDIT == type) { /* * Checking the Record Header (UserEditAtom) */ // final long lastSlideID = LittleEndian.getInt(pptdata, (int) i + 8); // final long version = LittleEndian.getUInt(pptdata, (int) i + 12); offset = (int) LittleEndian.getUInt(pptdata, (int) i + 16); offsetPD = LittleEndian.getUInt(pptdata, (int) i + 20); /* * Call to extract ClientTextBox text in each UserEditAtom */ containerTextBox = extractTextBoxes(containerTextBox, offset, pptdata, offsetPD); } else if (PPTConstants.PPT_ATOM_DRAWINGGROUP == type) { // if (LOG.isTraceEnabled()) { // LOG.trace("PPT_DRAWINGGROUP_ATOM ignored: " + type); // } } else if (PPTConstants.PPT_ATOM_TEXTBYTE == type) { // if (LOG.isTraceEnabled()) { // LOG.trace("PPT_TEXTBYTE_ATOM ignored: " + type); // } } else if (PPTConstants.PPT_ATOM_TEXTCHAR == type) { // if (LOG.isTraceEnabled()) { // LOG.trace("PPT_TEXTCHAR_ATOM ignored: " + type); // } } else { // no action // if (LOG.isTraceEnabled()) { // LOG.trace("type not handled: " + type); // } } } final List/* <PPTSlide> */ slides = extractSlides(offset, pptdata, offsetPD); if (slides.size() == 0) { if (LOG.isInfoEnabled()) { LOG.info("No slides extracted!"); } } else { Slide slide = (Slide) slides.get(slides.size() - 1); for (Enumeration enumeration = containerTextBox.elements(); enumeration.hasMoreElements();) { final TextBox textBox = (TextBox) enumeration.nextElement(); slide.addContent(textBox.getContent()); } /* * Merging TextBox data with Slide Data Printing the text from Slides * vector object. */ List scontent; for (int i = 0; i < slides.size(); i++) { slide = (Slide) slides.get(i); scontent = slide.getContent(); String contentText; for (int j = 0; j < scontent.size(); j++) { contentText = scontent.get(j).toString(); this.buf.append(contentText); // to avoid concatinated words we add a blank additional if (contentText.length() > 0 && !(contentText.endsWith("\r") || contentText.endsWith("\n"))) { this.buf.append(" "); } } } } } catch (Throwable ex) { // because of not killing complete crawling all Throwables are catched. if (LOG.isErrorEnabled()) { LOG.error("processPOIFSReaderEvent", ex); } } }
From source file:org.apache.nutch.parse.mspowerpoint.ContentReaderListener.java
License:Apache License
/** * Extracts the client text boxes of a slide. * /*from ww w . j a v a 2s . c o m*/ * @param containerTextBox * @param offset * @param pptdata * @param offsetPD * @return Hashtable * @see TextBox */ protected Hashtable/* <Long, TextBox> */ extractTextBoxes(final Hashtable/* <Long, TextBox> */ containerTextBox, final int offset, final byte[] pptdata, final long offsetPD) { // To hold temporary data FilteredStringWriter outStream = new FilteredStringWriter(); TextBox textBox; // Traversing the bytearray up to Presist directory position for (int i = offset; i < offsetPD - 20; i++) { try { // Record info // final long rinfo = LittleEndian.getUShort(pptdata, (int) i); // Record Type final long recordType = LittleEndian.getUShort(pptdata, i + 2); // Record Size final long recordSize = LittleEndian.getUInt(pptdata, i + 4); if (recordType == PPTConstants.PPT_ATOM_DRAWINGGROUP) { /* * Record type is of Drawing Group */ // Total number of objects // final long objectCount = LittleEndian.getUInt(pptdata, (int) i + // 8); // currentID = Group ID+number of objects long currentID = LittleEndian.getInt(pptdata, i + 12); currentID = ((int) (currentID / 1024)) * 1024; if (currentID == PPTConstants.PPT_MASTERSLIDE) { // Ignore Master Slide objects if (LOG.isTraceEnabled()) { LOG.trace("Ignore master slide."); } i++; continue; } // Check for the ClientTextBox GroupID existence if (containerTextBox.containsKey(new Long(currentID))) { // If exists get Client Textbox Group textBox = (TextBox) containerTextBox.get(new Long(currentID)); textBox.setContent(""); } else { textBox = new TextBox(currentID); containerTextBox.put(new Long(currentID), textBox); } /* * Iterating the bytearray for TextCharAtoms and TextBytesAtom */ if ((offsetPD - 20) != recordSize) { // TODO something wrong? Probably an OLE-Object, which we ignore. if (LOG.isDebugEnabled()) { LOG.debug("offsetPD - 20=" + (offsetPD - 20) + " recordsize=" + recordSize); } } else { for (int startPos = i + 8; startPos < offsetPD - 20 && startPos < recordSize; startPos++) { // && startPos < // recordSize?? try { // Record info // final long nrinfo = LittleEndian.getUShort(pptdata, (int) j); // Record Type final long ntype = LittleEndian.getUShort(pptdata, startPos + 2); // Record size // Note that the size doesn't include the 8 byte atom header final long nsize = LittleEndian.getUInt(pptdata, startPos + 4); if (ntype == PPTConstants.PPT_ATOM_DRAWINGGROUP) { /* * Break the loop if next GroupID found */ i = startPos - 1; break; } else if (ntype == PPTConstants.PPT_ATOM_TEXTBYTE) { // TextByteAtom record outStream = new FilteredStringWriter(); long ii = 0; for (ii = startPos + 6; ii <= startPos + 6 + nsize; ii++) { // For loop to changed to a function // if ((ii + 2) >= pptdata.length) // break; // FIXME outStream.write((char) (pptdata[(int) ii + 2])); } // Setting the identified text for Current // groupID textBox.setContent(textBox.getContent() + outStream.toString()); } else if (ntype == PPTConstants.PPT_ATOM_TEXTCHAR) { // TextCharAtom record final String strTempContent = new String(pptdata, startPos + 6, (int) (nsize) + 2); final byte bytes[] = strTempContent.getBytes(); if (true) { outStream = new FilteredStringWriter(); for (int ii = 0; ii < bytes.length - 1; ii += 2) { // For loop to changed to a function outStream.write((char) (pptdata[ii + 2])); } textBox.setContent(textBox.getContent() + outStream.toString()); } else { // this version is used within POI String text = StringUtil.getFromCompressedUnicode(bytes, 0, bytes.length); textBox.setContent(textBox.getContent() + text); } } else { // ignored // if (LOG.isTraceEnabled()) { // LOG.trace("Ignored atom type: " + type); // } } } catch (Throwable e) { if (LOG.isErrorEnabled()) { LOG.error("extractTextBoxes", e); } break; } } } } else { // Record type is ignored // if (LOG.isTraceEnabled()) { // LOG.trace("Ignored record type: " + type); // } } } catch (Throwable ee) { if (LOG.isErrorEnabled()) { LOG.error("extractClientTextBoxes", ee); } break; } } return containerTextBox; }
From source file:org.apache.nutch.parse.mspowerpoint.ContentReaderListener.java
License:Apache License
/** * Returns the Powerpoint <code>Slide</code> s of document as vector. * /* www.j a v a 2s.c o m*/ * @param offset * @param pptdata * @param offsetPD * @return Vector of the powerpoint slides. Contains * <code>{@link Slide Slide}</code> * @see Slide */ protected List /* <Slide> */ extractSlides(final long offset, final byte[] pptdata, final long offsetPD) { int sNum = 0; // List of all slides found final List/* <Slide> */ slides = new Vector/* <Slide> */(); // current slide data Slide currentSlide = null; // To store data found in TextCharAtoms and TextBytesAtoms FilteredStringWriter outStream; for (long i = offset; i < pptdata.length - 20; i++) { final long recordInfo = LittleEndian.getUShort(pptdata, (int) i); final long atomType = LittleEndian.getUShort(pptdata, (int) i + 2); final long atomSize = LittleEndian.getUInt(pptdata, (int) i + 4); if (atomType == PPTConstants.PPT_ATOM_TEXTBYTE) { /* * TextByteAtom record */ outStream = new FilteredStringWriter(); for (long ii = i + 6; (ii <= i + 6 + atomSize) && (ii + 2 < pptdata.length); ii++) { try { // if(ii+2 >= pptdata.length) break; //FIXME byte value = pptdata[(int) ii + 2]; outStream.write(value); } catch (ArrayIndexOutOfBoundsException ex) { if (LOG.isTraceEnabled()) { LOG.trace("size=" + pptdata.length); } if (LOG.isErrorEnabled()) { LOG.error("extractSlides", ex); } } } // Setting the identified text for Current Slide if (currentSlide != null) { currentSlide.addContent(outStream.toString()); } } else if (atomType == PPTConstants.PPT_ATOM_TEXTCHAR) { /* * TextCharAtom record */ outStream = new FilteredStringWriter(); final String strTempContent = new String(pptdata, (int) i + 6, (int) (atomSize) + 2); final byte bytes[] = strTempContent.getBytes(); for (int ii = 0; ii < bytes.length - 1; ii += 2) { outStream.write(Utils.getUnicodeCharacter(bytes, ii)); } // Setting the identified text for Current Slide if (currentSlide != null) { currentSlide.addContent(outStream.toString()); } } else if (atomType == PPTConstants.PPT_ATOM_SLIDEPERSISTANT) { /* * SlidePresistAtom Record */ if (sNum != 0) { outStream = new FilteredStringWriter(); final long slideID = LittleEndian.getUInt(pptdata, (int) i + 20); currentSlide = new Slide(slideID); // currentSlide.addContent(outStream.toString()); slides.add(currentSlide); } sNum++; } else if (atomType == PPTConstants.PPT_ATOM_DRAWINGGROUP) { /* * Diagram records are ignored */ if (LOG.isTraceEnabled()) { LOG.trace("Drawing Groups are ignored."); } break; } else { // ignored // if (LOG.isTraceEnabled()) { // LOG.trace("Unhandled atomType: " + atomType); // } } } return slides; }
From source file:org.apache.slide.extractor.MSPowerPointExtractor.java
License:Apache License
public void processPOIFSReaderEvent(POIFSReaderEvent event) { try {//from w w w . j ava2 s . co m if (!event.getName().equalsIgnoreCase("PowerPoint Document")) return; DocumentInputStream input = event.getStream(); byte[] buffer = new byte[input.available()]; input.read(buffer, 0, input.available()); for (int i = 0; i < buffer.length - 20; i++) { long type = LittleEndian.getUShort(buffer, i + 2); long size = LittleEndian.getUInt(buffer, i + 4); if (type == 4008) { writer.write(buffer, i + 4 + 1, (int) size + 3); i = i + 4 + 1 + (int) size - 1; } } } catch (Exception e) { } }
From source file:org.apache.tika.parser.executable.ExecutableParser.java
License:Apache License
/** * Parses a DOS or Windows PE file//from www. j a v a2s. c om */ public void parsePE(XHTMLContentHandler xhtml, Metadata metadata, InputStream stream, byte[] first4) throws TikaException, IOException { metadata.add(Metadata.CONTENT_TYPE, PE_EXE.toString()); metadata.set(PLATFORM, PLATFORM_WINDOWS); // Skip over the MS-DOS bit byte[] msdosSection = new byte[0x3c - 4]; IOUtils.readFully(stream, msdosSection); // Grab the PE header offset int peOffset = LittleEndian.readInt(stream); // Sanity check - while it may go anywhere, it's normally in the first few kb if (peOffset > 4096 || peOffset < 0x3f) return; // Skip the rest of the MS-DOS stub (if PE), until we reach what should // be the PE header (if this is a PE executable) stream.skip(peOffset - 0x40); // Read the PE header byte[] pe = new byte[24]; IOUtils.readFully(stream, pe); // Check it really is a PE header if (pe[0] == (byte) 'P' && pe[1] == (byte) 'E' && pe[2] == 0 && pe[3] == 0) { // Good, has a valid PE signature } else { // Old style MS-DOS return; } // Read the header values int machine = LittleEndian.getUShort(pe, 4); int numSectors = LittleEndian.getUShort(pe, 6); long createdAt = LittleEndian.getInt(pe, 8); long symbolTableOffset = LittleEndian.getInt(pe, 12); long numSymbols = LittleEndian.getInt(pe, 16); int sizeOptHdrs = LittleEndian.getUShort(pe, 20); int characteristcs = LittleEndian.getUShort(pe, 22); // Turn this into helpful metadata Date createdAtD = new Date(createdAt * 1000l); metadata.set(Metadata.CREATION_DATE, createdAtD); switch (machine) { case 0x14c: metadata.set(MACHINE_TYPE, MACHINE_x86_32); metadata.set(ENDIAN, Endian.LITTLE.getName()); metadata.set(ARCHITECTURE_BITS, "32"); break; case 0x8664: metadata.set(MACHINE_TYPE, MACHINE_x86_32); metadata.set(ENDIAN, Endian.LITTLE.getName()); metadata.set(ARCHITECTURE_BITS, "64"); break; case 0x200: metadata.set(MACHINE_TYPE, MACHINE_IA_64); metadata.set(ENDIAN, Endian.LITTLE.getName()); metadata.set(ARCHITECTURE_BITS, "64"); break; case 0x184: metadata.set(MACHINE_TYPE, MACHINE_ALPHA); metadata.set(ENDIAN, Endian.LITTLE.getName()); metadata.set(ARCHITECTURE_BITS, "32"); break; case 0x284: metadata.set(MACHINE_TYPE, MACHINE_ALPHA); metadata.set(ENDIAN, Endian.LITTLE.getName()); metadata.set(ARCHITECTURE_BITS, "64"); break; case 0x1c0: case 0x1c4: metadata.set(MACHINE_TYPE, MACHINE_ARM); metadata.set(ENDIAN, Endian.LITTLE.getName()); metadata.set(ARCHITECTURE_BITS, "32"); break; case 0x268: metadata.set(MACHINE_TYPE, MACHINE_M68K); metadata.set(ENDIAN, Endian.BIG.getName()); metadata.set(ARCHITECTURE_BITS, "32"); break; case 0x266: case 0x366: case 0x466: metadata.set(MACHINE_TYPE, MACHINE_MIPS); metadata.set(ENDIAN, Endian.BIG.getName()); metadata.set(ARCHITECTURE_BITS, "16"); break; case 0x162: case 0x166: case 0x168: case 0x169: metadata.set(MACHINE_TYPE, MACHINE_MIPS); metadata.set(ENDIAN, Endian.LITTLE.getName()); metadata.set(ARCHITECTURE_BITS, "16"); break; case 0x1f0: case 0x1f1: metadata.set(MACHINE_TYPE, MACHINE_PPC); metadata.set(ENDIAN, Endian.LITTLE.getName()); metadata.set(ARCHITECTURE_BITS, "32"); break; case 0x1a2: case 0x1a3: metadata.set(MACHINE_TYPE, MACHINE_SH3); metadata.set(ENDIAN, Endian.BIG.getName()); metadata.set(ARCHITECTURE_BITS, "32"); break; case 0x1a6: metadata.set(MACHINE_TYPE, MACHINE_SH4); metadata.set(ENDIAN, Endian.BIG.getName()); metadata.set(ARCHITECTURE_BITS, "32"); break; case 0x1a8: metadata.set(MACHINE_TYPE, MACHINE_SH3); metadata.set(ENDIAN, Endian.BIG.getName()); metadata.set(ARCHITECTURE_BITS, "32"); break; case 0x9041: metadata.set(MACHINE_TYPE, MACHINE_M32R); metadata.set(ENDIAN, Endian.BIG.getName()); metadata.set(ARCHITECTURE_BITS, "32"); break; case 0xebc: metadata.set(MACHINE_TYPE, MACHINE_EFI); break; default: metadata.set(MACHINE_TYPE, MACHINE_UNKNOWN); break; } }
From source file:org.ddt.listener.dsi.StringProperty.java
License:Apache License
/** * Constructor for making a StringProperty out of a VtUnalignedString. * * @param data byte array to read data from * @param offset offset into the data array to start at * @throws IllegalVariantTypeException if something in the stream is bung. * @throws UnsupportedEncodingException// w w w .j av a 2s . co m */ StringProperty(byte[] data, int offset) throws IllegalVariantTypeException, UnsupportedEncodingException { type = LittleEndian.getUShort(data, offset); offset += LittleEndian.INT_SIZE; //skip the two bytes padding as well read(data, offset); }