You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2021/05/22 21:37:10 UTC
svn commit: r1890122 [1/16] - in /poi/trunk/poi-scratchpad/src:
main/java/org/apache/poi/hdgf/ main/java/org/apache/poi/hdgf/chunks/
main/java/org/apache/poi/hdgf/dev/ main/java/org/apache/poi/hdgf/exceptions/
main/java/org/apache/poi/hdgf/extractor/ m...
Author: fanningpj
Date: Sat May 22 21:37:08 2021
New Revision: 1890122
URL: http://svn.apache.org/viewvc?rev=1890122&view=rev
Log:
convert tabs to spaces
Modified:
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/HDGFDiagram.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/Chunk.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkFactory.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkHeader.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkHeaderV4V5.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkHeaderV6.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkSeparator.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkTrailer.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/dev/VSDDumper.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/exceptions/HDGFException.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/extractor/VisioTextExtractor.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/ChunkStream.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/CompressedStreamStore.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/PointerContainingStream.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/Stream.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/StreamStore.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/StringsStream.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/TrailerStream.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/UnknownStream.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hpbf/model/EscherDelayStm.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hpbf/model/EscherPart.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hpbf/model/EscherStm.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hpbf/model/HPBFPart.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hpbf/model/MainContents.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hpbf/model/QuillContents.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hpbf/model/qcbits/QCBit.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hpbf/model/qcbits/QCPLCBit.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hpbf/model/qcbits/QCTextBit.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hpbf/model/qcbits/UnknownQCBit.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/blip/DIB.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/PPDrawingTextListing.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/PPTXMLDump.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SLWTListing.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SLWTTextListing.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideAndNotesAtomListing.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowDumper.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/SlideShowRecordDumper.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/TextStyleListing.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/dev/UserEditAndPersistListing.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/exceptions/CorruptPowerPointFileException.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/exceptions/EncryptedPowerPointFileException.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/exceptions/HSLFException.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/exceptions/OldPowerPointFormatException.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/model/textproperties/BitMaskTextProp.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/model/textproperties/CharFlagsTextProp.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/model/textproperties/FontAlignmentProp.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/model/textproperties/IndentProp.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/model/textproperties/ParagraphFlagsTextProp.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/model/textproperties/TextAlignmentProp.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/model/textproperties/TextPFException9.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/model/textproperties/TextProp.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/model/textproperties/TextPropCollection.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/AnimationInfo.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/BinaryTagDataBlob.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/CString.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ColorSchemeAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/Comment2000.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/Comment2000Atom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/CurrentUserAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/DocInfoListContainer.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/Document.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/DocumentAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/DocumentEncryptionAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/DummyPositionSensitiveRecordWithChildren.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/DummyRecordWithChildren.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/Environment.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/EscherTextboxWrapper.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExEmbedAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExHyperlink.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExHyperlinkAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExObjList.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExObjListAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExObjRefAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExOleObjAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ExVideoContainer.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/FontCollection.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/FontEntityAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/HeadersFootersAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/InteractiveInfo.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/InteractiveInfoAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/MainMaster.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/Notes.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/NotesAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/OEPlaceholderAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/PPDrawing.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/ParentAwareRecord.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/PersistPtrHolder.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/PositionDependentRecord.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/PositionDependentRecordAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/PositionDependentRecordContainer.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/Record.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/RecordAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/RecordContainer.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/Slide.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SlideAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SlideListWithText.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/SlidePersistAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/TextBytesAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/TextCharsAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/TextHeaderAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/UnknownRecordPlaceholder.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/record/UserEditAtom.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFObjectShape.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlide.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShow.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowEncrypted.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFSlideShowImpl.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFTextRun.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hslf/util/SystemTimeUtils.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/datatypes/PropertiesChunk.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hsmf/exceptions/ChunkNotFoundException.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/converter/AbstractWordUtils.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/extractor/Word6Extractor.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/BytePropertyNode.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/CHPBinTable.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/Ffn.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/FileInformationBlock.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/ListLevel.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/ListTables.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/OfficeArtContent.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/RevisionMarkAuthorTable.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/TextPiece.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/UnhandledDataStructure.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/sprm/CharacterSprmUncompressor.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/sprm/SprmUncompressor.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/HeaderStories.java
poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hwpf/usermodel/Range.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hdgf/TestHDGFLZW.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hdgf/chunks/TestChunks.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hdgf/extractor/TestVisioExtractor.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hdgf/pointers/TestPointerFactory.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hdgf/streams/TestStreamBasics.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hdgf/streams/TestStreamBugs.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hdgf/streams/TestStreamComplex.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hmef/attribute/TestTNEFAttributes.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hpbf/TestHPBFDocument.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hpbf/model/TestEscherParts.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hpbf/model/TestQuillContents.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/HSLFTestDataSamples.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/TestEncryptedFile.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/TestPOIDocumentScratchpad.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/TestRecordCounts.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/BaseTestPPTIterating.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/dev/TestSlideShowDumper.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/extractor/TestCruddyExtractor.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/model/TestOleEmbedding.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/model/TestSlideChangeNotes.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/model/TestTextRunReWrite.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestCString.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestColorSchemeAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestComment2000.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestComment2000Atom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestCurrentUserAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestDocument.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestDocumentAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestDocumentEncryptionAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExControl.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExHyperlink.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExHyperlinkAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExMediaAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExObjList.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExObjListAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestExOleObjAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestHeadersFootersAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestHeadersFootersContainer.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestInteractiveInfo.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestInteractiveInfoAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestNotesAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestRecordContainer.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestRecordTypes.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestSlideAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestSlidePersistAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestSound.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextBytesAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextCharsAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextHeaderAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextRulerAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTextSpecInfoAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestTxInteractiveInfoAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/record/TestUserEditAtom.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestBugs.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestCounts.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestMostRecentRecords.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestNotesText.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestNumberedList.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestNumberedList2.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestNumberedList3.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestPictures.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestReOrderingSlides.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestRecordSetup.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestRichTextRun.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestSheetText.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestSlideOrdering.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestTable.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestTextRun.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hslf/util/TestSystemTimeUtils.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hsmf/TestBasics.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hsmf/datatypes/TestChunkData.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hsmf/parsers/TestPOIFSChunkParser.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/TestHWPFPictures.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/TestHWPFRangeParts.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/extractor/TestDifferentRoutes.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/extractor/TestWordExtractor.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/extractor/TestWordExtractorBugs.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/model/TestSectionTable.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestBug46610.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestBug47563.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestHeaderStories.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestRangeDelete.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestRangeInsertion.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestRangeProperties.java
poi/trunk/poi-scratchpad/src/test/java/org/apache/poi/hwpf/usermodel/TestRangeReplacement.java
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/HDGFDiagram.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/HDGFDiagram.java?rev=1890122&r1=1890121&r2=1890122&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/HDGFDiagram.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/HDGFDiagram.java Sat May 22 21:37:08 2021
@@ -42,113 +42,113 @@ import org.apache.poi.util.LocaleUtil;
* http://www.gnome.ru/projects/docs/slide2.png
*/
public final class HDGFDiagram extends POIReadOnlyDocument {
- private static final String VISIO_HEADER = "Visio (TM) Drawing\r\n";
+ private static final String VISIO_HEADER = "Visio (TM) Drawing\r\n";
- private long docSize;
+ private long docSize;
- private Pointer trailerPointer;
- private TrailerStream trailer;
+ private Pointer trailerPointer;
+ private TrailerStream trailer;
- public HDGFDiagram(POIFSFileSystem fs) throws IOException {
- this(fs.getRoot());
- }
-
- public HDGFDiagram(DirectoryNode dir) throws IOException {
- super(dir);
-
- // Grab the document stream
- final byte[] _docstream;
- try (InputStream is = dir.createDocumentInputStream("VisioDocument")) {
- _docstream = IOUtils.toByteArray(is);
- }
-
- // Check it's really visio
- String typeString = new String(_docstream, 0, 20, LocaleUtil.CHARSET_1252 );
- if(! typeString.equals(VISIO_HEADER)) {
- throw new IllegalArgumentException("Wasn't a valid visio document, started with " + typeString);
- }
-
- // Grab the version number, 0x1a -> 0x1b
- short version = LittleEndian.getShort(_docstream, 0x1a);
- // Grab the document size, 0x1c -> 0x1f
- docSize = LittleEndian.getUInt(_docstream, 0x1c);
- // ??? 0x20 -> 0x23
-
- // Create the Chunk+Pointer Factories for the document version
- PointerFactory ptrFactory = new PointerFactory(version);
- ChunkFactory chunkFactory = new ChunkFactory(version);
-
- // Grab the pointer to the trailer
- trailerPointer = ptrFactory.createPointer(_docstream, 0x24);
-
- // Now grab the trailer
- trailer = (TrailerStream)
- Stream.createStream(trailerPointer, _docstream, chunkFactory, ptrFactory);
-
- // Finally, find all our streams
- trailer.findChildren(_docstream);
- }
-
- /**
- * Returns the TrailerStream, which is at the root of the
- * tree of Streams.
- *
- * @return the TrailerStream
- */
- public TrailerStream getTrailerStream() { return trailer; }
-
- /**
- * Returns all the top level streams, which are the streams
- * pointed to by the TrailerStream.
- *
- * @return the top level streams
- */
- public Stream[] getTopLevelStreams() { return trailer.getPointedToStreams(); }
-
- public long getDocumentSize() { return docSize; }
-
- /**
- * Prints out some simple debug on the base contents of the file.
- * @see org.apache.poi.hdgf.dev.VSDDumper
- */
- public void debug() {
- System.err.println("Trailer is at " + trailerPointer.getOffset());
- System.err.println("Trailer has type " + trailerPointer.getType());
- System.err.println("Trailer has length " + trailerPointer.getLength());
- System.err.println("Trailer has format " + trailerPointer.getFormat());
-
- for(int i=0; i<trailer.getPointedToStreams().length; i++) {
- Stream stream = trailer.getPointedToStreams()[i];
- Pointer ptr = stream.getPointer();
-
- System.err.println("Looking at pointer " + i);
- System.err.println("\tType is " + ptr.getType() + "\t\t" + Integer.toHexString(ptr.getType()));
- System.err.println("\tOffset is " + ptr.getOffset() + "\t\t" + Long.toHexString(ptr.getOffset()));
- System.err.println("\tAddress is " + ptr.getAddress() + "\t" + Long.toHexString(ptr.getAddress()));
- System.err.println("\tLength is " + ptr.getLength() + "\t\t" + Long.toHexString(ptr.getLength()));
- System.err.println("\tFormat is " + ptr.getFormat() + "\t\t" + Long.toHexString(ptr.getFormat()));
- System.err.println("\tCompressed is " + ptr.destinationCompressed());
- System.err.println("\tStream is " + stream.getClass());
-
- if(stream instanceof PointerContainingStream) {
- PointerContainingStream pcs = (PointerContainingStream)stream;
-
- if(pcs.getPointedToStreams() != null && pcs.getPointedToStreams().length > 0) {
- System.err.println("\tContains " + pcs.getPointedToStreams().length + " other pointers/streams");
- for(int j=0; j<pcs.getPointedToStreams().length; j++) {
- Stream ss = pcs.getPointedToStreams()[j];
- Pointer sptr = ss.getPointer();
- System.err.println("\t\t" + j + " - Type is " + sptr.getType() + "\t\t" + Integer.toHexString(sptr.getType()));
- System.err.println("\t\t" + j + " - Length is " + sptr.getLength() + "\t\t" + Long.toHexString(sptr.getLength()));
- }
- }
- }
-
- if(stream instanceof StringsStream) {
- System.err.println("\t\t**strings**");
- StringsStream ss = (StringsStream)stream;
- System.err.println("\t\t" + ss._getContentsLength());
- }
- }
- }
+ public HDGFDiagram(POIFSFileSystem fs) throws IOException {
+ this(fs.getRoot());
+ }
+
+ public HDGFDiagram(DirectoryNode dir) throws IOException {
+ super(dir);
+
+ // Grab the document stream
+ final byte[] _docstream;
+ try (InputStream is = dir.createDocumentInputStream("VisioDocument")) {
+ _docstream = IOUtils.toByteArray(is);
+ }
+
+ // Check it's really visio
+ String typeString = new String(_docstream, 0, 20, LocaleUtil.CHARSET_1252 );
+ if(! typeString.equals(VISIO_HEADER)) {
+ throw new IllegalArgumentException("Wasn't a valid visio document, started with " + typeString);
+ }
+
+ // Grab the version number, 0x1a -> 0x1b
+ short version = LittleEndian.getShort(_docstream, 0x1a);
+ // Grab the document size, 0x1c -> 0x1f
+ docSize = LittleEndian.getUInt(_docstream, 0x1c);
+ // ??? 0x20 -> 0x23
+
+ // Create the Chunk+Pointer Factories for the document version
+ PointerFactory ptrFactory = new PointerFactory(version);
+ ChunkFactory chunkFactory = new ChunkFactory(version);
+
+ // Grab the pointer to the trailer
+ trailerPointer = ptrFactory.createPointer(_docstream, 0x24);
+
+ // Now grab the trailer
+ trailer = (TrailerStream)
+ Stream.createStream(trailerPointer, _docstream, chunkFactory, ptrFactory);
+
+ // Finally, find all our streams
+ trailer.findChildren(_docstream);
+ }
+
+ /**
+ * Returns the TrailerStream, which is at the root of the
+ * tree of Streams.
+ *
+ * @return the TrailerStream
+ */
+ public TrailerStream getTrailerStream() { return trailer; }
+
+ /**
+ * Returns all the top level streams, which are the streams
+ * pointed to by the TrailerStream.
+ *
+ * @return the top level streams
+ */
+ public Stream[] getTopLevelStreams() { return trailer.getPointedToStreams(); }
+
+ public long getDocumentSize() { return docSize; }
+
+ /**
+ * Prints out some simple debug on the base contents of the file.
+ * @see org.apache.poi.hdgf.dev.VSDDumper
+ */
+ public void debug() {
+ System.err.println("Trailer is at " + trailerPointer.getOffset());
+ System.err.println("Trailer has type " + trailerPointer.getType());
+ System.err.println("Trailer has length " + trailerPointer.getLength());
+ System.err.println("Trailer has format " + trailerPointer.getFormat());
+
+ for(int i=0; i<trailer.getPointedToStreams().length; i++) {
+ Stream stream = trailer.getPointedToStreams()[i];
+ Pointer ptr = stream.getPointer();
+
+ System.err.println("Looking at pointer " + i);
+ System.err.println("\tType is " + ptr.getType() + "\t\t" + Integer.toHexString(ptr.getType()));
+ System.err.println("\tOffset is " + ptr.getOffset() + "\t\t" + Long.toHexString(ptr.getOffset()));
+ System.err.println("\tAddress is " + ptr.getAddress() + "\t" + Long.toHexString(ptr.getAddress()));
+ System.err.println("\tLength is " + ptr.getLength() + "\t\t" + Long.toHexString(ptr.getLength()));
+ System.err.println("\tFormat is " + ptr.getFormat() + "\t\t" + Long.toHexString(ptr.getFormat()));
+ System.err.println("\tCompressed is " + ptr.destinationCompressed());
+ System.err.println("\tStream is " + stream.getClass());
+
+ if(stream instanceof PointerContainingStream) {
+ PointerContainingStream pcs = (PointerContainingStream)stream;
+
+ if(pcs.getPointedToStreams() != null && pcs.getPointedToStreams().length > 0) {
+ System.err.println("\tContains " + pcs.getPointedToStreams().length + " other pointers/streams");
+ for(int j=0; j<pcs.getPointedToStreams().length; j++) {
+ Stream ss = pcs.getPointedToStreams()[j];
+ Pointer sptr = ss.getPointer();
+ System.err.println("\t\t" + j + " - Type is " + sptr.getType() + "\t\t" + Integer.toHexString(sptr.getType()));
+ System.err.println("\t\t" + j + " - Length is " + sptr.getLength() + "\t\t" + Long.toHexString(sptr.getLength()));
+ }
+ }
+ }
+
+ if(stream instanceof StringsStream) {
+ System.err.println("\t\t**strings**");
+ StringsStream ss = (StringsStream)stream;
+ System.err.println("\t\t" + ss._getContentsLength());
+ }
+ }
+ }
}
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/Chunk.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/Chunk.java?rev=1890122&r1=1890121&r2=1890122&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/Chunk.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/Chunk.java Sat May 22 21:37:08 2021
@@ -286,11 +286,11 @@ public final class Chunk {
* process CommandDefinitions, and so doesn't actually exist
* in the chunk
*/
-// public static class VirtualCommand extends Command {
-// private VirtualCommand(CommandDefinition definition) {
-// super(definition);
-// }
-// }
+// public static class VirtualCommand extends Command {
+// private VirtualCommand(CommandDefinition definition) {
+// super(definition);
+// }
+// }
/**
* A special kind of command that holds the offset to
* a block
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkFactory.java?rev=1890122&r1=1890121&r2=1890122&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkFactory.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkFactory.java Sat May 22 21:37:08 2021
@@ -42,182 +42,182 @@ import static org.apache.logging.log4j.u
*/
public final class ChunkFactory {
- //arbitrarily selected; may need to increase
- private static final int MAX_RECORD_LENGTH = 1_000_000;
+ //arbitrarily selected; may need to increase
+ private static final int MAX_RECORD_LENGTH = 1_000_000;
- /** The version of the currently open document */
- private int version;
- /**
- * Key is a Chunk's type, value is an array of its CommandDefinitions
- */
- private final Map<Integer, CommandDefinition[]> chunkCommandDefinitions =
+ /** The version of the currently open document */
+ private int version;
+ /**
+ * Key is a Chunk's type, value is an array of its CommandDefinitions
+ */
+ private final Map<Integer, CommandDefinition[]> chunkCommandDefinitions =
new HashMap<>();
- /**
- * What the name is of the chunk table definitions file?
- * This file comes from the scratchpad resources directory.
- */
- private static final String chunkTableName =
- "/org/apache/poi/hdgf/chunks_parse_cmds.tbl";
-
- /** For logging problems we spot with the file */
- private static final Logger LOG = LogManager.getLogger(ChunkFactory.class);
-
- public ChunkFactory(int version) throws IOException {
- this.version = version;
-
- processChunkParseCommands();
- }
-
- /**
- * Open chunks_parse_cmds.tbl and process it, to get the definitions
- * of all the different possible chunk commands.
- */
- private void processChunkParseCommands() throws IOException {
- try (InputStream cpd = ChunkFactory.class.getResourceAsStream(chunkTableName)) {
- if(cpd == null) {
- throw new IllegalStateException("Unable to find HDGF chunk definition on the classpath - " + chunkTableName);
- }
-
- try (BufferedReader inp = new BufferedReader(new InputStreamReader(cpd, LocaleUtil.CHARSET_1252))) {
- String line;
- while ((line = inp.readLine()) != null) {
- if (line.isEmpty() || "# \t".contains(line.substring(0, 1))) {
- continue;
- }
-
- // Start xxx
- if (!line.matches("^start [0-9]+$")) {
- throw new IllegalStateException("Expecting start xxx, found " + line);
- }
- int chunkType = Integer.parseInt(line.substring(6));
- ArrayList<CommandDefinition> defsL = new ArrayList<>();
-
- // Data entries
- while ((line = inp.readLine()) != null) {
- if (line.startsWith("end")) {
- break;
- }
- StringTokenizer st = new StringTokenizer(line, " ");
- int defType = Integer.parseInt(st.nextToken());
- int offset = Integer.parseInt(st.nextToken());
- String name = st.nextToken("\uffff").substring(1);
-
- CommandDefinition def = new CommandDefinition(defType, offset, name);
- defsL.add(def);
- }
-
- CommandDefinition[] defs = defsL.toArray(new CommandDefinition[0]);
-
- // Add to the map
- chunkCommandDefinitions.put(chunkType, defs);
- }
- }
- }
- }
-
- public int getVersion() { return version; }
-
- /**
- * Creates the appropriate chunk at the given location.
- *
- * @param data the chunk bytes
- * @param offset the offset into the chunk bytes array to start reading from
- *
- * @return the new Chunk
- */
- public Chunk createChunk(byte[] data, int offset) {
- // Create the header
- ChunkHeader header =
- ChunkHeader.createChunkHeader(version, data, offset);
- // Sanity check
- if(header.getLength() < 0) {
- throw new IllegalArgumentException("Found a chunk with a negative length, which isn't allowed");
- }
-
- // How far up to look
- int endOfDataPos = offset + header.getLength() + header.getSizeInBytes();
-
- // Check we have enough data, and tweak the header size
- // as required
- if(endOfDataPos > data.length) {
- LOG.atWarn().log("Header called for {} bytes, but that would take us past the end of the data!", box(header.getLength()));
-
- endOfDataPos = data.length;
- header.setLength(data.length - offset - header.getSizeInBytes());
-
- if(header.hasTrailer()) {
- header.setLength(header.getLength() - 8);
- endOfDataPos -= 8;
- }
- if(header.hasSeparator()) {
+ /**
+ * What the name is of the chunk table definitions file?
+ * This file comes from the scratchpad resources directory.
+ */
+ private static final String chunkTableName =
+ "/org/apache/poi/hdgf/chunks_parse_cmds.tbl";
+
+ /** For logging problems we spot with the file */
+ private static final Logger LOG = LogManager.getLogger(ChunkFactory.class);
+
+ public ChunkFactory(int version) throws IOException {
+ this.version = version;
+
+ processChunkParseCommands();
+ }
+
+ /**
+ * Open chunks_parse_cmds.tbl and process it, to get the definitions
+ * of all the different possible chunk commands.
+ */
+ private void processChunkParseCommands() throws IOException {
+ try (InputStream cpd = ChunkFactory.class.getResourceAsStream(chunkTableName)) {
+ if(cpd == null) {
+ throw new IllegalStateException("Unable to find HDGF chunk definition on the classpath - " + chunkTableName);
+ }
+
+ try (BufferedReader inp = new BufferedReader(new InputStreamReader(cpd, LocaleUtil.CHARSET_1252))) {
+ String line;
+ while ((line = inp.readLine()) != null) {
+ if (line.isEmpty() || "# \t".contains(line.substring(0, 1))) {
+ continue;
+ }
+
+ // Start xxx
+ if (!line.matches("^start [0-9]+$")) {
+ throw new IllegalStateException("Expecting start xxx, found " + line);
+ }
+ int chunkType = Integer.parseInt(line.substring(6));
+ ArrayList<CommandDefinition> defsL = new ArrayList<>();
+
+ // Data entries
+ while ((line = inp.readLine()) != null) {
+ if (line.startsWith("end")) {
+ break;
+ }
+ StringTokenizer st = new StringTokenizer(line, " ");
+ int defType = Integer.parseInt(st.nextToken());
+ int offset = Integer.parseInt(st.nextToken());
+ String name = st.nextToken("\uffff").substring(1);
+
+ CommandDefinition def = new CommandDefinition(defType, offset, name);
+ defsL.add(def);
+ }
+
+ CommandDefinition[] defs = defsL.toArray(new CommandDefinition[0]);
+
+ // Add to the map
+ chunkCommandDefinitions.put(chunkType, defs);
+ }
+ }
+ }
+ }
+
+ public int getVersion() { return version; }
+
+ /**
+ * Creates the appropriate chunk at the given location.
+ *
+ * @param data the chunk bytes
+ * @param offset the offset into the chunk bytes array to start reading from
+ *
+ * @return the new Chunk
+ */
+ public Chunk createChunk(byte[] data, int offset) {
+ // Create the header
+ ChunkHeader header =
+ ChunkHeader.createChunkHeader(version, data, offset);
+ // Sanity check
+ if(header.getLength() < 0) {
+ throw new IllegalArgumentException("Found a chunk with a negative length, which isn't allowed");
+ }
+
+ // How far up to look
+ int endOfDataPos = offset + header.getLength() + header.getSizeInBytes();
+
+ // Check we have enough data, and tweak the header size
+ // as required
+ if(endOfDataPos > data.length) {
+ LOG.atWarn().log("Header called for {} bytes, but that would take us past the end of the data!", box(header.getLength()));
+
+ endOfDataPos = data.length;
+ header.setLength(data.length - offset - header.getSizeInBytes());
+
+ if(header.hasTrailer()) {
+ header.setLength(header.getLength() - 8);
+ endOfDataPos -= 8;
+ }
+ if(header.hasSeparator()) {
header.setLength(header.getLength() - 4);
- endOfDataPos -= 4;
- }
- }
-
-
- // Create the trailer and separator, if required
- ChunkTrailer trailer = null;
- ChunkSeparator separator = null;
- if(header.hasTrailer()) {
- if(endOfDataPos <= data.length-8) {
- trailer = new ChunkTrailer(
- data, endOfDataPos);
- endOfDataPos += 8;
- } else {
- LOG.atError().log("Header claims a length to {} there's then no space for the trailer in the data ({})", box(endOfDataPos),box(data.length));
- }
- }
- if(header.hasSeparator()) {
- if(endOfDataPos <= data.length-4) {
- separator = new ChunkSeparator(
- data, endOfDataPos);
- } else {
- LOG.atError().log("Header claims a length to {} there's then no space for the separator in the data ({})", box(endOfDataPos),box(data.length));
- }
- }
-
- // Now, create the chunk
- byte[] contents = IOUtils.safelyClone(data, offset+header.getSizeInBytes(), header.getLength(), MAX_RECORD_LENGTH);
- Chunk chunk = new Chunk(header, trailer, separator, contents);
-
- // Feed in the stuff from chunks_parse_cmds.tbl
- CommandDefinition[] defs = chunkCommandDefinitions.get(header.getType());
- if (defs == null) {
- defs = new CommandDefinition[0];
- }
- chunk.setCommandDefinitions(defs);
-
- // Now get the chunk to process its commands
- chunk.processCommands();
-
- // All done
- return chunk;
- }
-
- /**
- * The definition of a Command, which a chunk may hold.
- * The Command holds the value, this describes it.
- */
- public static class CommandDefinition {
- private int type;
- private int offset;
- private String name;
- public CommandDefinition(int type, int offset, String name) {
- this.type = type;
- this.offset = offset;
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
- public int getOffset() {
- return offset;
- }
- public int getType() {
- return type;
- }
- }
+ endOfDataPos -= 4;
+ }
+ }
+
+
+ // Create the trailer and separator, if required
+ ChunkTrailer trailer = null;
+ ChunkSeparator separator = null;
+ if(header.hasTrailer()) {
+ if(endOfDataPos <= data.length-8) {
+ trailer = new ChunkTrailer(
+ data, endOfDataPos);
+ endOfDataPos += 8;
+ } else {
+ LOG.atError().log("Header claims a length to {} there's then no space for the trailer in the data ({})", box(endOfDataPos),box(data.length));
+ }
+ }
+ if(header.hasSeparator()) {
+ if(endOfDataPos <= data.length-4) {
+ separator = new ChunkSeparator(
+ data, endOfDataPos);
+ } else {
+ LOG.atError().log("Header claims a length to {} there's then no space for the separator in the data ({})", box(endOfDataPos),box(data.length));
+ }
+ }
+
+ // Now, create the chunk
+ byte[] contents = IOUtils.safelyClone(data, offset+header.getSizeInBytes(), header.getLength(), MAX_RECORD_LENGTH);
+ Chunk chunk = new Chunk(header, trailer, separator, contents);
+
+ // Feed in the stuff from chunks_parse_cmds.tbl
+ CommandDefinition[] defs = chunkCommandDefinitions.get(header.getType());
+ if (defs == null) {
+ defs = new CommandDefinition[0];
+ }
+ chunk.setCommandDefinitions(defs);
+
+ // Now get the chunk to process its commands
+ chunk.processCommands();
+
+ // All done
+ return chunk;
+ }
+
+ /**
+ * The definition of a Command, which a chunk may hold.
+ * The Command holds the value, this describes it.
+ */
+ public static class CommandDefinition {
+ private int type;
+ private int offset;
+ private String name;
+ public CommandDefinition(int type, int offset, String name) {
+ this.type = type;
+ this.offset = offset;
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+ public int getOffset() {
+ return offset;
+ }
+ public int getType() {
+ return type;
+ }
+ }
}
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkHeader.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkHeader.java?rev=1890122&r1=1890121&r2=1890122&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkHeader.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkHeader.java Sat May 22 21:37:08 2021
@@ -25,98 +25,98 @@ import org.apache.poi.util.LittleEndian;
* A chunk header
*/
public abstract class ChunkHeader {
- private int type;
- private int id;
- private int length;
- private int unknown1;
-
- /**
- * Creates the appropriate ChunkHeader for the Chunk Header at
- * the given location, for the given document version.
- *
- * @param documentVersion the documentVersion - 4 and higher is supported
- * @param data the chunk data
- * @param offset the start offset in the chunk data
- * @return the ChunkHeader
- */
- public static ChunkHeader createChunkHeader(int documentVersion, byte[] data, int offset) {
- if(documentVersion >= 6) {
- ChunkHeaderV6 ch;
- if(documentVersion > 6) {
- ch = new ChunkHeaderV11();
- } else {
- ch = new ChunkHeaderV6();
- }
- ch.setType((int)LittleEndian.getUInt(data, offset + 0));
- ch.setId((int)LittleEndian.getUInt(data, offset + 4));
- ch.setUnknown1((int)LittleEndian.getUInt(data, offset + 8));
- ch.setLength((int)LittleEndian.getUInt(data, offset + 12));
- ch.setUnknown2(LittleEndian.getShort(data, offset + 16));
- ch.setUnknown3(LittleEndian.getUByte(data, offset + 18));
-
- return ch;
- } else if(documentVersion == 5 || documentVersion == 4) {
- ChunkHeaderV4V5 ch = new ChunkHeaderV4V5();
-
- ch.setType(LittleEndian.getShort(data, offset + 0));
- ch.setId(LittleEndian.getShort(data, offset + 2));
- ch.setUnknown2(LittleEndian.getUByte(data, offset + 4));
- ch.setUnknown3(LittleEndian.getUByte(data, offset + 5));
- ch.setUnknown1(LittleEndian.getShort(data, offset + 6));
- ch.setLength(Math.toIntExact(LittleEndian.getUInt(data, offset + 8)));
-
- return ch;
- } else {
- throw new IllegalArgumentException("Visio files with versions below 4 are not supported, yours was " + documentVersion);
- }
- }
-
- /**
- * Returns the size of a chunk header for the given document version.
- *
- * @param documentVersion the documentVersion - 4 and higher is supported
- *
- * @return the header size
- */
- public static int getHeaderSize(int documentVersion) {
- return documentVersion >= 6 ? ChunkHeaderV6.getHeaderSize() : ChunkHeaderV4V5.getHeaderSize();
- }
-
- public abstract int getSizeInBytes();
- public abstract boolean hasTrailer();
- public abstract boolean hasSeparator();
- public abstract Charset getChunkCharset();
-
- /**
- * @return the ID/IX of the chunk
- */
- public int getId() {
- return id;
- }
-
- /**
- * Returns the length of the trunk, excluding the length
- * of the header, trailer or separator.
- *
- * @return the length of the trunk
- */
- public int getLength() {
- return length;
- }
-
- /**
- * Returns the type of the chunk, which affects the
- * mandatory information
- *
- * @return the type of the chunk
- */
- public int getType() {
- return type;
- }
-
- public int getUnknown1() {
- return unknown1;
- }
+ private int type;
+ private int id;
+ private int length;
+ private int unknown1;
+
+ /**
+ * Creates the appropriate ChunkHeader for the Chunk Header at
+ * the given location, for the given document version.
+ *
+ * @param documentVersion the documentVersion - 4 and higher is supported
+ * @param data the chunk data
+ * @param offset the start offset in the chunk data
+ * @return the ChunkHeader
+ */
+ public static ChunkHeader createChunkHeader(int documentVersion, byte[] data, int offset) {
+ if(documentVersion >= 6) {
+ ChunkHeaderV6 ch;
+ if(documentVersion > 6) {
+ ch = new ChunkHeaderV11();
+ } else {
+ ch = new ChunkHeaderV6();
+ }
+ ch.setType((int)LittleEndian.getUInt(data, offset + 0));
+ ch.setId((int)LittleEndian.getUInt(data, offset + 4));
+ ch.setUnknown1((int)LittleEndian.getUInt(data, offset + 8));
+ ch.setLength((int)LittleEndian.getUInt(data, offset + 12));
+ ch.setUnknown2(LittleEndian.getShort(data, offset + 16));
+ ch.setUnknown3(LittleEndian.getUByte(data, offset + 18));
+
+ return ch;
+ } else if(documentVersion == 5 || documentVersion == 4) {
+ ChunkHeaderV4V5 ch = new ChunkHeaderV4V5();
+
+ ch.setType(LittleEndian.getShort(data, offset + 0));
+ ch.setId(LittleEndian.getShort(data, offset + 2));
+ ch.setUnknown2(LittleEndian.getUByte(data, offset + 4));
+ ch.setUnknown3(LittleEndian.getUByte(data, offset + 5));
+ ch.setUnknown1(LittleEndian.getShort(data, offset + 6));
+ ch.setLength(Math.toIntExact(LittleEndian.getUInt(data, offset + 8)));
+
+ return ch;
+ } else {
+ throw new IllegalArgumentException("Visio files with versions below 4 are not supported, yours was " + documentVersion);
+ }
+ }
+
+ /**
+ * Returns the size of a chunk header for the given document version.
+ *
+ * @param documentVersion the documentVersion - 4 and higher is supported
+ *
+ * @return the header size
+ */
+ public static int getHeaderSize(int documentVersion) {
+ return documentVersion >= 6 ? ChunkHeaderV6.getHeaderSize() : ChunkHeaderV4V5.getHeaderSize();
+ }
+
+ public abstract int getSizeInBytes();
+ public abstract boolean hasTrailer();
+ public abstract boolean hasSeparator();
+ public abstract Charset getChunkCharset();
+
+ /**
+ * @return the ID/IX of the chunk
+ */
+ public int getId() {
+ return id;
+ }
+
+ /**
+ * Returns the length of the trunk, excluding the length
+ * of the header, trailer or separator.
+ *
+ * @return the length of the trunk
+ */
+ public int getLength() {
+ return length;
+ }
+
+ /**
+ * Returns the type of the chunk, which affects the
+ * mandatory information
+ *
+ * @return the type of the chunk
+ */
+ public int getType() {
+ return type;
+ }
+
+ public int getUnknown1() {
+ return unknown1;
+ }
void setType(int type) {
this.type = type;
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkHeaderV4V5.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkHeaderV4V5.java?rev=1890122&r1=1890121&r2=1890122&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkHeaderV4V5.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkHeaderV4V5.java Sat May 22 21:37:08 2021
@@ -23,46 +23,46 @@ import java.nio.charset.Charset;
* A chunk header from v4 or v5
*/
public final class ChunkHeaderV4V5 extends ChunkHeader {
- private short unknown2;
- private short unknown3;
+ private short unknown2;
+ private short unknown3;
- public short getUnknown2() {
- return unknown2;
- }
- public short getUnknown3() {
- return unknown3;
- }
-
- protected static int getHeaderSize() {
- return 12;
- }
-
- public int getSizeInBytes() {
- return getHeaderSize();
- }
-
- /**
- * Does the chunk have a trailer?
- */
- public boolean hasTrailer() {
- // V4 and V5 never has trailers
- return false;
- }
-
- /**
- * Does the chunk have a separator?
- */
- public boolean hasSeparator() {
- // V4 and V5 never has separators
- return false;
- }
-
- @Override
- public Charset getChunkCharset() {
- return Charset.forName("ASCII");
- }
+ public short getUnknown2() {
+ return unknown2;
+ }
+ public short getUnknown3() {
+ return unknown3;
+ }
+
+ protected static int getHeaderSize() {
+ return 12;
+ }
+
+ public int getSizeInBytes() {
+ return getHeaderSize();
+ }
+
+ /**
+ * Does the chunk have a trailer?
+ */
+ public boolean hasTrailer() {
+ // V4 and V5 never has trailers
+ return false;
+ }
+
+ /**
+ * Does the chunk have a separator?
+ */
+ public boolean hasSeparator() {
+ // V4 and V5 never has separators
+ return false;
+ }
+
+ @Override
+ public Charset getChunkCharset() {
+ return Charset.forName("ASCII");
+ }
- void setUnknown2(short unknown2) {
+ void setUnknown2(short unknown2) {
this.unknown2 = unknown2;
}
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkHeaderV6.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkHeaderV6.java?rev=1890122&r1=1890121&r2=1890122&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkHeaderV6.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkHeaderV6.java Sat May 22 21:37:08 2021
@@ -23,49 +23,49 @@ import java.nio.charset.Charset;
* A chunk header from v6
*/
public class ChunkHeaderV6 extends ChunkHeader {
- private short unknown2;
- private short unknown3;
+ private short unknown2;
+ private short unknown3;
- public short getUnknown2() {
- return unknown2;
- }
- public short getUnknown3() {
- return unknown3;
- }
-
- protected static int getHeaderSize() {
- // Looks like it ought to be 19...
- return 19;
- }
- public int getSizeInBytes() {
- return getHeaderSize();
- }
-
- /**
- * Does the chunk have a trailer?
- */
- public boolean hasTrailer() {
- switch (getType()) {
- case 0x2c: case 0x65: case 0x66: case 0x69:
- case 0x6a: case 0x6b: case 0x70: case 0x71:
- return true;
+ public short getUnknown2() {
+ return unknown2;
+ }
+ public short getUnknown3() {
+ return unknown3;
+ }
+
+ protected static int getHeaderSize() {
+ // Looks like it ought to be 19...
+ return 19;
+ }
+ public int getSizeInBytes() {
+ return getHeaderSize();
+ }
+
+ /**
+ * Does the chunk have a trailer?
+ */
+ public boolean hasTrailer() {
+ switch (getType()) {
+ case 0x2c: case 0x65: case 0x66: case 0x69:
+ case 0x6a: case 0x6b: case 0x70: case 0x71:
+ return true;
default:
return (getUnknown1() != 0);
- }
- }
+ }
+ }
- /**
- * Does the chunk have a separator?
- */
- public boolean hasSeparator() {
- // V6 never has separators
- return false;
- }
-
- @Override
- public Charset getChunkCharset() {
- return Charset.forName("ASCII");
- }
+ /**
+ * Does the chunk have a separator?
+ */
+ public boolean hasSeparator() {
+ // V6 never has separators
+ return false;
+ }
+
+ @Override
+ public Charset getChunkCharset() {
+ return Charset.forName("ASCII");
+ }
void setUnknown2(short unknown2) {
this.unknown2 = unknown2;
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkSeparator.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkSeparator.java?rev=1890122&r1=1890121&r2=1890122&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkSeparator.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkSeparator.java Sat May 22 21:37:08 2021
@@ -24,13 +24,13 @@ import java.util.Arrays;
* header of the next one
*/
public final class ChunkSeparator {
- final byte[] separatorData;
+ final byte[] separatorData;
- public ChunkSeparator(byte[] data, int offset) {
- separatorData = Arrays.copyOfRange(data, offset, offset+4);
- }
+ public ChunkSeparator(byte[] data, int offset) {
+ separatorData = Arrays.copyOfRange(data, offset, offset+4);
+ }
- public String toString() {
- return "<ChunkSeparator of length " + separatorData.length + ">";
- }
+ public String toString() {
+ return "<ChunkSeparator of length " + separatorData.length + ">";
+ }
}
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkTrailer.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkTrailer.java?rev=1890122&r1=1890121&r2=1890122&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkTrailer.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/chunks/ChunkTrailer.java Sat May 22 21:37:08 2021
@@ -23,15 +23,15 @@ import java.util.Arrays;
* A trailer that follows a chunk
*/
public final class ChunkTrailer {
- private final byte[] trailerData;
+ private final byte[] trailerData;
- public ChunkTrailer(byte[] data, int offset) {
- trailerData = Arrays.copyOfRange(data, offset, offset+8);
- }
+ public ChunkTrailer(byte[] data, int offset) {
+ trailerData = Arrays.copyOfRange(data, offset, offset+8);
+ }
- public String toString() {
- return "<ChunkTrailer of length " + trailerData.length + ">";
- }
+ public String toString() {
+ return "<ChunkTrailer of length " + trailerData.length + ">";
+ }
byte[] getTrailerData() {
return trailerData;
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/dev/VSDDumper.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/dev/VSDDumper.java?rev=1890122&r1=1890121&r2=1890122&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/dev/VSDDumper.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/dev/VSDDumper.java Sat May 22 21:37:08 2021
@@ -44,63 +44,63 @@ public final class VSDDumper {
this.hdgf = hdgf;
}
- public static void main(String[] args) throws Exception {
- if(args.length == 0) {
- System.err.println("Use:");
- System.err.println(" VSDDumper <filename>");
- System.exit(1);
- }
+ public static void main(String[] args) throws Exception {
+ if(args.length == 0) {
+ System.err.println("Use:");
+ System.err.println(" VSDDumper <filename>");
+ System.exit(1);
+ }
- try (POIFSFileSystem poifs = new POIFSFileSystem(new File(args[0]));
- HDGFDiagram hdgf = new HDGFDiagram(poifs)) {
+ try (POIFSFileSystem poifs = new POIFSFileSystem(new File(args[0]));
+ HDGFDiagram hdgf = new HDGFDiagram(poifs)) {
PrintStream ps = System.out;
ps.println("Opened " + args[0]);
VSDDumper vd = new VSDDumper(ps, hdgf);
vd.dumpFile();
}
- }
+ }
- public void dumpFile() {
+ public void dumpFile() {
dumpVal("Claimed document size", hdgf.getDocumentSize(), 0);
ps.println();
dumpStream(hdgf.getTrailerStream(), 0);
- }
+ }
- private void dumpStream(Stream stream, int indent) {
- Pointer ptr = stream.getPointer();
- dumpVal("Stream at", ptr.getOffset(), indent);
- dumpVal("Type is", ptr.getType(), indent+1);
- dumpVal("Format is", ptr.getFormat(), indent+1);
+ private void dumpStream(Stream stream, int indent) {
+ Pointer ptr = stream.getPointer();
+ dumpVal("Stream at", ptr.getOffset(), indent);
+ dumpVal("Type is", ptr.getType(), indent+1);
+ dumpVal("Format is", ptr.getFormat(), indent+1);
dumpVal("Length is", ptr.getLength(), indent+1);
- if(ptr.destinationCompressed()) {
- dumpVal("DC.Length is", stream._getContentsLength(), indent+1);
- }
- dumpVal("Compressed is", ptr.destinationCompressed(), indent+1);
- dumpVal("Stream is", stream.getClass().getName(), indent+1);
-
- byte[] db = stream._getStore()._getContents();
- String ds = (db.length >= 8) ? Arrays.toString(db) : "[]";
- dumpVal("First few bytes are", ds, indent+1);
+ if(ptr.destinationCompressed()) {
+ dumpVal("DC.Length is", stream._getContentsLength(), indent+1);
+ }
+ dumpVal("Compressed is", ptr.destinationCompressed(), indent+1);
+ dumpVal("Stream is", stream.getClass().getName(), indent+1);
+
+ byte[] db = stream._getStore()._getContents();
+ String ds = (db.length >= 8) ? Arrays.toString(db) : "[]";
+ dumpVal("First few bytes are", ds, indent+1);
- if (stream instanceof PointerContainingStream) {
+ if (stream instanceof PointerContainingStream) {
Stream[] streams = ((PointerContainingStream) stream).getPointedToStreams();
- dumpVal("Nbr of children", streams.length, indent+1);
+ dumpVal("Nbr of children", streams.length, indent+1);
- for(Stream s : streams) {
- dumpStream(s, indent+1);
- }
- }
- if(stream instanceof ChunkStream) {
+ for(Stream s : streams) {
+ dumpStream(s, indent+1);
+ }
+ }
+ if(stream instanceof ChunkStream) {
Chunk[] chunks = ((ChunkStream) stream).getChunks();
- dumpVal("Nbr of chunks", chunks.length, indent+1);
+ dumpVal("Nbr of chunks", chunks.length, indent+1);
- for(Chunk chunk : chunks) {
- dumpChunk(chunk, indent+1);
- }
- }
- }
+ for(Chunk chunk : chunks) {
+ dumpChunk(chunk, indent+1);
+ }
+ }
+ }
- private void dumpChunk(Chunk chunk, int indent) {
+ private void dumpChunk(Chunk chunk, int indent) {
dumpVal(chunk.getName(), "", indent);
dumpVal("Length is", chunk._getContents().length, indent);
dumpVal("OD Size is", chunk.getOnDiskSize(), indent);
@@ -110,9 +110,9 @@ public final class VSDDumper {
for(Command command : commands) {
dumpVal(command.getDefinition().getName(), ""+command.getValue(), indent+1);
}
- }
+ }
- private void dumpVal(String label, long value, int indent) {
+ private void dumpVal(String label, long value, int indent) {
ps.print(tabs.substring(0,indent));
ps.print(label);
ps.print('\t');
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/exceptions/HDGFException.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/exceptions/HDGFException.java?rev=1890122&r1=1890121&r2=1890122&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/exceptions/HDGFException.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/exceptions/HDGFException.java Sat May 22 21:37:08 2021
@@ -23,11 +23,11 @@ package org.apache.poi.hdgf.exceptions;
public final class HDGFException extends RuntimeException {
public HDGFException() {
- super();
+ super();
}
public HDGFException(String message) {
- super(message);
+ super(message);
}
public HDGFException(String message, Throwable cause) {
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/extractor/VisioTextExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/extractor/VisioTextExtractor.java?rev=1890122&r1=1890121&r2=1890122&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/extractor/VisioTextExtractor.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/extractor/VisioTextExtractor.java Sat May 22 21:37:08 2021
@@ -38,103 +38,103 @@ import org.apache.poi.poifs.filesystem.P
* can return the text for you (example: for use with Lucene).
*/
public final class VisioTextExtractor implements POIOLE2TextExtractor {
- private HDGFDiagram hdgf;
- private boolean doCloseFilesystem = true;
+ private HDGFDiagram hdgf;
+ private boolean doCloseFilesystem = true;
- public VisioTextExtractor(HDGFDiagram hdgf) {
- this.hdgf = hdgf;
- }
- public VisioTextExtractor(POIFSFileSystem fs) throws IOException {
- this(fs.getRoot());
- }
-
- public VisioTextExtractor(DirectoryNode dir) throws IOException {
- this(new HDGFDiagram(dir));
- }
-
- public VisioTextExtractor(InputStream inp) throws IOException {
- this(new POIFSFileSystem(inp));
- }
-
- /**
- * Locates all the text entries in the file, and returns their
- * contents.
- *
- * @return An array of each Text item in the document
- */
- public String[] getAllText() {
- List<String> text = new ArrayList<>();
- for(Stream stream : hdgf.getTopLevelStreams()) {
- findText(stream, text);
- }
- return text.toArray(new String[0]);
- }
- private void findText(Stream stream, List<String> text) {
- if(stream instanceof PointerContainingStream) {
- PointerContainingStream ps = (PointerContainingStream)stream;
- for(final Stream substream : ps.getPointedToStreams()) {
- findText(substream, text);
- }
- }
- if(stream instanceof ChunkStream) {
- ChunkStream cs = (ChunkStream)stream;
- for(final Chunk chunk : cs.getChunks()) {
- if(chunk != null &&
- chunk.getName() != null &&
- "Text".equals(chunk.getName()) &&
- chunk.getCommands().length > 0) {
-
- // First command
- Command cmd = chunk.getCommands()[0];
- if(cmd != null && cmd.getValue() != null) {
- // Capture the text, as long as it isn't
- // simply an empty string
- String str = cmd.getValue().toString();
- if (!(str.isEmpty() || "\n".equals(str))) {
- text.add( str );
- }
- }
- }
- }
- }
- }
-
- /**
- * Returns the textual contents of the file.
- * Each textual object's text will be separated
- * by a newline
- *
- * @return All text contained in this document, separated by <code>\n</code>
- */
- @Override
- public String getText() {
- StringBuilder text = new StringBuilder();
- for(String t : getAllText()) {
- text.append(t);
- if(!t.endsWith("\r") && !t.endsWith("\n")) {
- text.append('\n');
- }
- }
- return text.toString();
- }
-
- @Override
- public HDGFDiagram getDocument() {
- return hdgf;
- }
-
- @Override
- public void setCloseFilesystem(boolean doCloseFilesystem) {
- this.doCloseFilesystem = doCloseFilesystem;
- }
-
- @Override
- public boolean isCloseFilesystem() {
- return doCloseFilesystem;
- }
-
- @Override
- public HDGFDiagram getFilesystem() {
- return hdgf;
- }
+ public VisioTextExtractor(HDGFDiagram hdgf) {
+ this.hdgf = hdgf;
+ }
+ public VisioTextExtractor(POIFSFileSystem fs) throws IOException {
+ this(fs.getRoot());
+ }
+
+ public VisioTextExtractor(DirectoryNode dir) throws IOException {
+ this(new HDGFDiagram(dir));
+ }
+
+ public VisioTextExtractor(InputStream inp) throws IOException {
+ this(new POIFSFileSystem(inp));
+ }
+
+ /**
+ * Locates all the text entries in the file, and returns their
+ * contents.
+ *
+ * @return An array of each Text item in the document
+ */
+ public String[] getAllText() {
+ List<String> text = new ArrayList<>();
+ for(Stream stream : hdgf.getTopLevelStreams()) {
+ findText(stream, text);
+ }
+ return text.toArray(new String[0]);
+ }
+ private void findText(Stream stream, List<String> text) {
+ if(stream instanceof PointerContainingStream) {
+ PointerContainingStream ps = (PointerContainingStream)stream;
+ for(final Stream substream : ps.getPointedToStreams()) {
+ findText(substream, text);
+ }
+ }
+ if(stream instanceof ChunkStream) {
+ ChunkStream cs = (ChunkStream)stream;
+ for(final Chunk chunk : cs.getChunks()) {
+ if(chunk != null &&
+ chunk.getName() != null &&
+ "Text".equals(chunk.getName()) &&
+ chunk.getCommands().length > 0) {
+
+ // First command
+ Command cmd = chunk.getCommands()[0];
+ if(cmd != null && cmd.getValue() != null) {
+ // Capture the text, as long as it isn't
+ // simply an empty string
+ String str = cmd.getValue().toString();
+ if (!(str.isEmpty() || "\n".equals(str))) {
+ text.add( str );
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns the textual contents of the file.
+ * Each textual object's text will be separated
+ * by a newline
+ *
+ * @return All text contained in this document, separated by <code>\n</code>
+ */
+ @Override
+ public String getText() {
+ StringBuilder text = new StringBuilder();
+ for(String t : getAllText()) {
+ text.append(t);
+ if(!t.endsWith("\r") && !t.endsWith("\n")) {
+ text.append('\n');
+ }
+ }
+ return text.toString();
+ }
+
+ @Override
+ public HDGFDiagram getDocument() {
+ return hdgf;
+ }
+
+ @Override
+ public void setCloseFilesystem(boolean doCloseFilesystem) {
+ this.doCloseFilesystem = doCloseFilesystem;
+ }
+
+ @Override
+ public boolean isCloseFilesystem() {
+ return doCloseFilesystem;
+ }
+
+ @Override
+ public HDGFDiagram getFilesystem() {
+ return hdgf;
+ }
}
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/ChunkStream.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/ChunkStream.java?rev=1890122&r1=1890121&r2=1890122&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/ChunkStream.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/ChunkStream.java Sat May 22 21:37:08 2021
@@ -29,55 +29,55 @@ import org.apache.poi.hdgf.pointers.Poin
import static org.apache.logging.log4j.util.Unbox.box;
public final class ChunkStream extends Stream {
- private static final Logger LOG = LogManager.getLogger(ChunkStream.class);
+ private static final Logger LOG = LogManager.getLogger(ChunkStream.class);
- private final ChunkFactory chunkFactory;
- /** All the Chunks we contain */
- private Chunk[] chunks;
-
- ChunkStream(Pointer pointer, StreamStore store, ChunkFactory chunkFactory) {
- super(pointer, store);
- this.chunkFactory = chunkFactory;
-
- // For compressed stores, we require all of the data
- store.copyBlockHeaderToContents();
- }
-
- public Chunk[] getChunks() { return chunks; }
-
- /**
- * Process the contents of the stream out into chunks
- */
- public void findChunks() {
- ArrayList<Chunk> chunksA = new ArrayList<>();
-
- if(getPointer().getOffset() == 0x64b3) {
- int i = 0;
- i++;
- }
-
- int pos = 0;
- byte[] contents = getStore().getContents();
- try {
- while(pos < contents.length) {
- // Ensure we have enough data to create a chunk from
- int headerSize = ChunkHeader.getHeaderSize(chunkFactory.getVersion());
- if(pos+headerSize <= contents.length) {
- Chunk chunk = chunkFactory.createChunk(contents, pos);
- chunksA.add(chunk);
-
- pos += chunk.getOnDiskSize();
- } else {
- LOG.atWarn().log("Needed {} bytes to create the next chunk header, but only found {} bytes, ignoring rest of data", box(headerSize),box(contents.length - pos));
- pos = contents.length;
- }
- }
- }
- catch (Exception e)
- {
- LOG.atError().withThrowable(e).log("Failed to create chunk at {}, ignoring rest of data.", box(pos));
- }
+ private final ChunkFactory chunkFactory;
+ /** All the Chunks we contain */
+ private Chunk[] chunks;
+
+ ChunkStream(Pointer pointer, StreamStore store, ChunkFactory chunkFactory) {
+ super(pointer, store);
+ this.chunkFactory = chunkFactory;
+
+ // For compressed stores, we require all of the data
+ store.copyBlockHeaderToContents();
+ }
+
+ public Chunk[] getChunks() { return chunks; }
+
+ /**
+ * Process the contents of the stream out into chunks
+ */
+ public void findChunks() {
+ ArrayList<Chunk> chunksA = new ArrayList<>();
+
+ if(getPointer().getOffset() == 0x64b3) {
+ int i = 0;
+ i++;
+ }
+
+ int pos = 0;
+ byte[] contents = getStore().getContents();
+ try {
+ while(pos < contents.length) {
+ // Ensure we have enough data to create a chunk from
+ int headerSize = ChunkHeader.getHeaderSize(chunkFactory.getVersion());
+ if(pos+headerSize <= contents.length) {
+ Chunk chunk = chunkFactory.createChunk(contents, pos);
+ chunksA.add(chunk);
+
+ pos += chunk.getOnDiskSize();
+ } else {
+ LOG.atWarn().log("Needed {} bytes to create the next chunk header, but only found {} bytes, ignoring rest of data", box(headerSize),box(contents.length - pos));
+ pos = contents.length;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.atError().withThrowable(e).log("Failed to create chunk at {}, ignoring rest of data.", box(pos));
+ }
- chunks = chunksA.toArray(new Chunk[0]);
- }
+ chunks = chunksA.toArray(new Chunk[0]);
+ }
}
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/CompressedStreamStore.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/CompressedStreamStore.java?rev=1890122&r1=1890121&r2=1890122&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/CompressedStreamStore.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/CompressedStreamStore.java Sat May 22 21:37:08 2021
@@ -29,69 +29,69 @@ import org.apache.poi.util.IOUtils;
*/
public final class CompressedStreamStore extends StreamStore {
- //arbitrarily selected; may need to increase
- private static final int MAX_RECORD_LENGTH = 64_000_000;
+ //arbitrarily selected; may need to increase
+ private static final int MAX_RECORD_LENGTH = 64_000_000;
- /** The raw, compressed contents */
- private byte[] compressedContents;
- /**
- * We're not sure what this is, but it comes before the
- * real contents in the de-compressed data
- */
- private final byte[] blockHeader;
- private boolean blockHeaderInContents;
-
- byte[] _getCompressedContents() { return compressedContents; }
- byte[] _getBlockHeader() { return blockHeader; }
-
- /**
- * Creates a new compressed StreamStore, which will handle
- * the decompression.
- */
- CompressedStreamStore(byte[] data, int offset, int length) throws IOException {
- this(decompress(data,offset,length));
- compressedContents = IOUtils.safelyClone(data, offset, length, MAX_RECORD_LENGTH);
- }
- /**
- * Handles passing the de-compressed data onto our superclass.
- */
- private CompressedStreamStore(byte[][] decompressedData) {
- super(decompressedData[1], 0, decompressedData[1].length);
- blockHeader = decompressedData[0];
- }
-
- /**
- * Some kinds of streams expect their 4 byte header to be
- * on the front of the contents.
- * They can call this to have it sorted.
- */
- protected void copyBlockHeaderToContents() {
- if(blockHeaderInContents) return;
-
- prependContentsWith(blockHeader);
- blockHeaderInContents = true;
- }
-
-
- /**
- * Decompresses the given data, returning it as header + contents
- */
- public static byte[][] decompress(byte[] data, int offset, int length) throws IOException {
- ByteArrayInputStream bais = new ByteArrayInputStream(data, offset, length);
-
- // Decompress
- HDGFLZW lzw = new HDGFLZW();
- byte[] decompressed = lzw.decompress(bais);
-
- // Split into header and contents
- byte[][] ret = new byte[2][];
- ret[0] = new byte[4];
- ret[1] = new byte[decompressed.length - 4];
-
- System.arraycopy(decompressed, 0, ret[0], 0, 4);
- System.arraycopy(decompressed, 4, ret[1], 0, ret[1].length);
-
- // All done
- return ret;
- }
+ /** The raw, compressed contents */
+ private byte[] compressedContents;
+ /**
+ * We're not sure what this is, but it comes before the
+ * real contents in the de-compressed data
+ */
+ private final byte[] blockHeader;
+ private boolean blockHeaderInContents;
+
+ byte[] _getCompressedContents() { return compressedContents; }
+ byte[] _getBlockHeader() { return blockHeader; }
+
+ /**
+ * Creates a new compressed StreamStore, which will handle
+ * the decompression.
+ */
+ CompressedStreamStore(byte[] data, int offset, int length) throws IOException {
+ this(decompress(data,offset,length));
+ compressedContents = IOUtils.safelyClone(data, offset, length, MAX_RECORD_LENGTH);
+ }
+ /**
+ * Handles passing the de-compressed data onto our superclass.
+ */
+ private CompressedStreamStore(byte[][] decompressedData) {
+ super(decompressedData[1], 0, decompressedData[1].length);
+ blockHeader = decompressedData[0];
+ }
+
+ /**
+ * Some kinds of streams expect their 4 byte header to be
+ * on the front of the contents.
+ * They can call this to have it sorted.
+ */
+ protected void copyBlockHeaderToContents() {
+ if(blockHeaderInContents) return;
+
+ prependContentsWith(blockHeader);
+ blockHeaderInContents = true;
+ }
+
+
+ /**
+ * Decompresses the given data, returning it as header + contents
+ */
+ public static byte[][] decompress(byte[] data, int offset, int length) throws IOException {
+ ByteArrayInputStream bais = new ByteArrayInputStream(data, offset, length);
+
+ // Decompress
+ HDGFLZW lzw = new HDGFLZW();
+ byte[] decompressed = lzw.decompress(bais);
+
+ // Split into header and contents
+ byte[][] ret = new byte[2][];
+ ret[0] = new byte[4];
+ ret[1] = new byte[decompressed.length - 4];
+
+ System.arraycopy(decompressed, 0, ret[0], 0, 4);
+ System.arraycopy(decompressed, 4, ret[1], 0, ret[1].length);
+
+ // All done
+ return ret;
+ }
}
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/PointerContainingStream.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/PointerContainingStream.java?rev=1890122&r1=1890121&r2=1890122&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/PointerContainingStream.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/PointerContainingStream.java Sat May 22 21:37:08 2021
@@ -26,56 +26,56 @@ import org.apache.poi.hdgf.pointers.Poin
* other data too.
*/
public class PointerContainingStream extends Stream { // TODO - instantiable superclass
- private Pointer[] childPointers;
- private Stream[] childStreams;
+ private Pointer[] childPointers;
+ private Stream[] childStreams;
- private ChunkFactory chunkFactory;
- private PointerFactory pointerFactory;
+ private ChunkFactory chunkFactory;
+ private PointerFactory pointerFactory;
- protected PointerContainingStream(Pointer pointer, StreamStore store, ChunkFactory chunkFactory, PointerFactory pointerFactory) {
- super(pointer, store);
- this.chunkFactory = chunkFactory;
- this.pointerFactory = pointerFactory;
-
- // Have the child pointers identified and created
- childPointers = pointerFactory.createContainerPointers(pointer, store.getContents());
- }
-
- /**
- * Returns all the pointers that we contain
- */
- protected Pointer[] getChildPointers() { return childPointers; }
- /**
- * Returns all the "child" streams.
- * These are all the streams pointed to by the pointers
- * that we contain.
- */
- public Stream[] getPointedToStreams() { return childStreams; }
-
- /**
- * Performs a recursive search, identifying the pointers we contain,
- * creating the Streams for where they point to, then searching
- * those if appropriate.
- */
- public void findChildren(byte[] documentData) {
- // For each pointer, generate the Stream it points to
- childStreams = new Stream[childPointers.length];
- for(int i=0; i<childPointers.length; i++) {
- Pointer ptr = childPointers[i];
- childStreams[i] = Stream.createStream(ptr, documentData, chunkFactory, pointerFactory);
-
- // Process chunk streams into their chunks
- if(childStreams[i] instanceof ChunkStream) {
- ChunkStream child = (ChunkStream)childStreams[i];
- child.findChunks();
- }
-
- // Recurse into pointer containing streams
- if(childStreams[i] instanceof PointerContainingStream) {
- PointerContainingStream child =
- (PointerContainingStream)childStreams[i];
- child.findChildren(documentData);
- }
- }
- }
+ protected PointerContainingStream(Pointer pointer, StreamStore store, ChunkFactory chunkFactory, PointerFactory pointerFactory) {
+ super(pointer, store);
+ this.chunkFactory = chunkFactory;
+ this.pointerFactory = pointerFactory;
+
+ // Have the child pointers identified and created
+ childPointers = pointerFactory.createContainerPointers(pointer, store.getContents());
+ }
+
+ /**
+ * Returns all the pointers that we contain
+ */
+ protected Pointer[] getChildPointers() { return childPointers; }
+ /**
+ * Returns all the "child" streams.
+ * These are all the streams pointed to by the pointers
+ * that we contain.
+ */
+ public Stream[] getPointedToStreams() { return childStreams; }
+
+ /**
+ * Performs a recursive search, identifying the pointers we contain,
+ * creating the Streams for where they point to, then searching
+ * those if appropriate.
+ */
+ public void findChildren(byte[] documentData) {
+ // For each pointer, generate the Stream it points to
+ childStreams = new Stream[childPointers.length];
+ for(int i=0; i<childPointers.length; i++) {
+ Pointer ptr = childPointers[i];
+ childStreams[i] = Stream.createStream(ptr, documentData, chunkFactory, pointerFactory);
+
+ // Process chunk streams into their chunks
+ if(childStreams[i] instanceof ChunkStream) {
+ ChunkStream child = (ChunkStream)childStreams[i];
+ child.findChunks();
+ }
+
+ // Recurse into pointer containing streams
+ if(childStreams[i] instanceof PointerContainingStream) {
+ PointerContainingStream child =
+ (PointerContainingStream)childStreams[i];
+ child.findChildren(documentData);
+ }
+ }
+ }
}
Modified: poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/Stream.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/Stream.java?rev=1890122&r1=1890121&r2=1890122&view=diff
==============================================================================
--- poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/Stream.java (original)
+++ poi/trunk/poi-scratchpad/src/main/java/org/apache/poi/hdgf/streams/Stream.java Sat May 22 21:37:08 2021
@@ -32,62 +32,62 @@ import org.apache.poi.hdgf.exceptions.HD
* disk, but that doesn't appear to change their use.
*/
public abstract class Stream {
- private Pointer pointer;
- private StreamStore store;
+ private Pointer pointer;
+ private StreamStore store;
- public Pointer getPointer() { return pointer; }
- protected StreamStore getStore() { return store; }
- public StreamStore _getStore() { return store; }
- public int _getContentsLength() { return store.getContents().length; }
+ public Pointer getPointer() { return pointer; }
+ protected StreamStore getStore() { return store; }
+ public StreamStore _getStore() { return store; }
+ public int _getContentsLength() { return store.getContents().length; }
- /**
- * Creates a new Stream, having already used the pointer
- * to build a store
- */
- protected Stream(Pointer pointer, StreamStore store) {
- this.pointer = pointer;
- this.store = store;
- }
+ /**
+ * Creates a new Stream, having already used the pointer
+ * to build a store
+ */
+ protected Stream(Pointer pointer, StreamStore store) {
+ this.pointer = pointer;
+ this.store = store;
+ }
- /**
- * Uses the pointer to locate a Stream within the document
- * data, and creates it.
- * @param pointer The Pointer to create a stream for
- * @param documentData The raw document data
- */
- public static Stream createStream(Pointer pointer, byte[] documentData, ChunkFactory chunkFactory, PointerFactory pointerFactory) {
- // Create the store
- StreamStore store;
- if(pointer.destinationCompressed()) {
- try {
- store = new CompressedStreamStore(
- documentData, pointer.getOffset(), pointer.getLength()
- );
- } catch(IOException e) {
- // Should never occur
- throw new HDGFException(e);
- }
- } else {
- store = new StreamStore(
- documentData, pointer.getOffset(), pointer.getLength()
- );
- }
+ /**
+ * Uses the pointer to locate a Stream within the document
+ * data, and creates it.
+ * @param pointer The Pointer to create a stream for
+ * @param documentData The raw document data
+ */
+ public static Stream createStream(Pointer pointer, byte[] documentData, ChunkFactory chunkFactory, PointerFactory pointerFactory) {
+ // Create the store
+ StreamStore store;
+ if(pointer.destinationCompressed()) {
+ try {
+ store = new CompressedStreamStore(
+ documentData, pointer.getOffset(), pointer.getLength()
+ );
+ } catch(IOException e) {
+ // Should never occur
+ throw new HDGFException(e);
+ }
+ } else {
+ store = new StreamStore(
+ documentData, pointer.getOffset(), pointer.getLength()
+ );
+ }
- // Figure out what sort of Stream to create, create and return it
- if(pointer.getType() == 20) {
- return new TrailerStream(pointer, store, chunkFactory, pointerFactory);
- }
- else if(pointer.destinationHasPointers()) {
- return new PointerContainingStream(pointer, store, chunkFactory, pointerFactory);
- }
- else if(pointer.destinationHasChunks()) {
- return new ChunkStream(pointer, store, chunkFactory);
- }
- else if(pointer.destinationHasStrings()) {
- return new StringsStream(pointer, store, chunkFactory);
- }
+ // Figure out what sort of Stream to create, create and return it
+ if(pointer.getType() == 20) {
+ return new TrailerStream(pointer, store, chunkFactory, pointerFactory);
+ }
+ else if(pointer.destinationHasPointers()) {
+ return new PointerContainingStream(pointer, store, chunkFactory, pointerFactory);
+ }
+ else if(pointer.destinationHasChunks()) {
+ return new ChunkStream(pointer, store, chunkFactory);
+ }
+ else if(pointer.destinationHasStrings()) {
+ return new StringsStream(pointer, store, chunkFactory);
+ }
- // Give up and return a generic one
- return new UnknownStream(pointer, store);
- }
+ // Give up and return a generic one
+ return new UnknownStream(pointer, store);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org