diff --git a/src/examples/src/org/apache/poi/hpsf/examples/CopyCompare.java b/src/examples/src/org/apache/poi/hpsf/examples/CopyCompare.java index f30dc8be0..b5bc87562 100644 --- a/src/examples/src/org/apache/poi/hpsf/examples/CopyCompare.java +++ b/src/examples/src/org/apache/poi/hpsf/examples/CopyCompare.java @@ -32,7 +32,6 @@ import java.util.Map; import org.apache.poi.hpsf.HPSFRuntimeException; import org.apache.poi.hpsf.MarkUnsupportedException; -import org.apache.poi.hpsf.MutablePropertySet; import org.apache.poi.hpsf.NoPropertySetStreamException; import org.apache.poi.hpsf.PropertySet; import org.apache.poi.hpsf.PropertySetFactory; @@ -55,9 +54,8 @@ import org.apache.poi.util.TempFile; * *

Property set streams are copied logically, i.e. the application * establishes a {@link org.apache.poi.hpsf.PropertySet} of an original property - * set, creates a {@link org.apache.poi.hpsf.MutablePropertySet} from the - * {@link org.apache.poi.hpsf.PropertySet} and writes the - * {@link org.apache.poi.hpsf.MutablePropertySet} to the destination POI file + * set, creates a {@link org.apache.poi.hpsf.PropertySet} and writes the + * {@link org.apache.poi.hpsf.PropertySet} to the destination POI file * system. - Streams which are no property set streams are copied bit by * bit.

* @@ -283,7 +281,7 @@ public class CopyCompare * everything unmodified to the destination POI filesystem. Property set * streams are copied by creating a new {@link PropertySet} from the * original property set by using the {@link - * MutablePropertySet#MutablePropertySet(PropertySet)} constructor.

+ * PropertySet#PropertySet(PropertySet)} constructor.

*/ static class CopyFile implements POIFSReaderListener { private String dstName; @@ -377,7 +375,7 @@ public class CopyCompare final PropertySet ps) throws WritingNotSupportedException, IOException { final DirectoryEntry de = getPath(poiFs, path); - final MutablePropertySet mps = new MutablePropertySet(ps); + final PropertySet mps = new PropertySet(ps); de.createDocument(name, mps.toInputStream()); } diff --git a/src/examples/src/org/apache/poi/hpsf/examples/WriteAuthorAndTitle.java b/src/examples/src/org/apache/poi/hpsf/examples/WriteAuthorAndTitle.java index e5454aa93..af0042e43 100644 --- a/src/examples/src/org/apache/poi/hpsf/examples/WriteAuthorAndTitle.java +++ b/src/examples/src/org/apache/poi/hpsf/examples/WriteAuthorAndTitle.java @@ -28,16 +28,7 @@ import java.io.OutputStream; import java.util.HashMap; import java.util.Map; -import org.apache.poi.hpsf.HPSFRuntimeException; -import org.apache.poi.hpsf.MarkUnsupportedException; -import org.apache.poi.hpsf.MutablePropertySet; -import org.apache.poi.hpsf.MutableSection; -import org.apache.poi.hpsf.NoPropertySetStreamException; -import org.apache.poi.hpsf.PropertySet; -import org.apache.poi.hpsf.PropertySetFactory; -import org.apache.poi.hpsf.SummaryInformation; -import org.apache.poi.hpsf.Variant; -import org.apache.poi.hpsf.WritingNotSupportedException; +import org.apache.poi.hpsf.*; import org.apache.poi.hpsf.wellknown.PropertyIDMap; import org.apache.poi.poifs.eventfilesystem.POIFSReader; import org.apache.poi.poifs.eventfilesystem.POIFSReaderEvent; @@ -240,12 +231,11 @@ public class WriteAuthorAndTitle /* Create a mutable property set as a copy of the original read-only * property set. */ - final MutablePropertySet mps = new MutablePropertySet(si); + final PropertySet mps = new PropertySet(si); /* Retrieve the section containing the properties to modify. A * summary information property set contains exactly one section. */ - final MutableSection s = - (MutableSection) mps.getSections().get(0); + final Section s = mps.getSections().get(0); /* Set the properties. */ s.setProperty(PropertyIDMap.PID_AUTHOR, Variant.VT_LPSTR, @@ -281,7 +271,7 @@ public class WriteAuthorAndTitle throws WritingNotSupportedException, IOException { final DirectoryEntry de = getPath(poiFs, path); - final MutablePropertySet mps = new MutablePropertySet(ps); + final PropertySet mps = new PropertySet(ps); de.createDocument(name, mps.toInputStream()); } diff --git a/src/examples/src/org/apache/poi/hpsf/examples/WriteTitle.java b/src/examples/src/org/apache/poi/hpsf/examples/WriteTitle.java index 4323ce242..464f958b3 100644 --- a/src/examples/src/org/apache/poi/hpsf/examples/WriteTitle.java +++ b/src/examples/src/org/apache/poi/hpsf/examples/WriteTitle.java @@ -21,12 +21,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import org.apache.poi.hpsf.MutableProperty; -import org.apache.poi.hpsf.MutablePropertySet; -import org.apache.poi.hpsf.MutableSection; -import org.apache.poi.hpsf.SummaryInformation; -import org.apache.poi.hpsf.Variant; -import org.apache.poi.hpsf.WritingNotSupportedException; +import org.apache.poi.hpsf.*; import org.apache.poi.hpsf.wellknown.PropertyIDMap; import org.apache.poi.hpsf.wellknown.SectionIDMap; import org.apache.poi.poifs.filesystem.POIFSFileSystem; @@ -61,10 +56,10 @@ public class WriteTitle /* Create a mutable property set. Initially it contains a single section * with no properties. */ - final MutablePropertySet mps = new MutablePropertySet(); + final PropertySet mps = new PropertySet(); /* Retrieve the section the property set already contains. */ - final MutableSection ms = (MutableSection) mps.getSections().get(0); + final Section ms = mps.getSections().get(0); /* Turn the property set into a summary information property. This is * done by setting the format ID of its first section to @@ -72,7 +67,7 @@ public class WriteTitle ms.setFormatID(SectionIDMap.SUMMARY_INFORMATION_ID); /* Create an empty property. */ - final MutableProperty p = new MutableProperty(); + final Property p = new Property(); /* Fill the property with appropriate settings so that it specifies the * document's title. */ diff --git a/src/java/org/apache/poi/hpsf/CustomProperties.java b/src/java/org/apache/poi/hpsf/CustomProperties.java index da4e9277b..8652c3a44 100644 --- a/src/java/org/apache/poi/hpsf/CustomProperties.java +++ b/src/java/org/apache/poi/hpsf/CustomProperties.java @@ -151,7 +151,7 @@ public class CustomProperties implements Map { } else { throw new IllegalStateException("unsupported datatype - currently String,Short,Integer,Long,Float,Double,Boolean,BigInteger(unsigned long),Date can be processed."); } - final Property p = new MutableProperty(-1, variantType, value); + final Property p = new Property(-1, variantType, value); return put(new CustomProperty(p, key)); } diff --git a/src/java/org/apache/poi/hpsf/CustomProperty.java b/src/java/org/apache/poi/hpsf/CustomProperty.java index 83511655a..9602cf8f4 100644 --- a/src/java/org/apache/poi/hpsf/CustomProperty.java +++ b/src/java/org/apache/poi/hpsf/CustomProperty.java @@ -23,7 +23,7 @@ package org.apache.poi.hpsf; * properties have an optional name. If the name is not {@code null} it * will be maintained in the section's dictionary. */ -public class CustomProperty extends MutableProperty +public class CustomProperty extends Property { private String name; diff --git a/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java b/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java index cea4d5dd9..7d86a2b0f 100644 --- a/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java +++ b/src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java @@ -33,7 +33,7 @@ import org.apache.poi.hpsf.wellknown.SectionIDMap; * * @see SummaryInformation */ -public class DocumentSummaryInformation extends SpecialPropertySet { +public class DocumentSummaryInformation extends PropertySet { /** * The document name a document summary information stream * usually has in a POIFS filesystem. @@ -811,7 +811,7 @@ public class DocumentSummaryInformation extends SpecialPropertySet { */ private void ensureSection2() { if (getSectionCount() < 2) { - Section s2 = new MutableSection(); + Section s2 = new Section(); s2.setFormatID(SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID[1]); addSection(s2); } diff --git a/src/java/org/apache/poi/hpsf/MutableProperty.java b/src/java/org/apache/poi/hpsf/MutableProperty.java deleted file mode 100644 index 106ad6f24..000000000 --- a/src/java/org/apache/poi/hpsf/MutableProperty.java +++ /dev/null @@ -1,55 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hpsf; - -import java.io.UnsupportedEncodingException; - -import org.apache.poi.util.LittleEndianByteArrayInputStream; -import org.apache.poi.util.Removal; - -/** - *

Adds writing capability to the {@link Property} class.

- * - *

Please be aware that this class' functionality will be merged into the - * {@link Property} class at a later time, so the API will change.

- * - * @deprecated POI 3.16 - use Property as base class instead - */ -@Deprecated -@Removal(version="3.18") -public class MutableProperty extends Property { - public MutableProperty() {} - - public MutableProperty(final Property p) { - super(p); - } - - public MutableProperty(final long id, final long type, final Object value) { - super(id, type, value); - } - - public MutableProperty(final long id, final byte[] src, final long offset, final int length, final int codepage) - throws UnsupportedEncodingException { - super(id, src, offset, length, codepage); - } - - public MutableProperty(final long id, LittleEndianByteArrayInputStream leis, final int length, final int codepage) - throws UnsupportedEncodingException { - super(id, leis, length, codepage); - } -} diff --git a/src/java/org/apache/poi/hpsf/MutablePropertySet.java b/src/java/org/apache/poi/hpsf/MutablePropertySet.java deleted file mode 100644 index 60f043af9..000000000 --- a/src/java/org/apache/poi/hpsf/MutablePropertySet.java +++ /dev/null @@ -1,46 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hpsf; - -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; - -import org.apache.poi.util.Removal; - -/** - * dds writing support to the {@link PropertySet} class.

- * - * Please be aware that this class' functionality will be merged into the - * {@link PropertySet} class at a later time, so the API will change. - * - * @deprecated POI 3.16 - use PropertySet as base class instead - */ -@Removal(version="3.18") -public class MutablePropertySet extends PropertySet { - public MutablePropertySet() {} - - public MutablePropertySet(final PropertySet ps) { - super(ps); - } - - /* package */ MutablePropertySet(final InputStream stream) - throws NoPropertySetStreamException, MarkUnsupportedException, IOException, UnsupportedEncodingException { - super(stream); - } -} diff --git a/src/java/org/apache/poi/hpsf/MutableSection.java b/src/java/org/apache/poi/hpsf/MutableSection.java deleted file mode 100644 index c5f0d6e0c..000000000 --- a/src/java/org/apache/poi/hpsf/MutableSection.java +++ /dev/null @@ -1,43 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hpsf; - -import java.io.UnsupportedEncodingException; - -import org.apache.poi.util.Removal; - -/** - *

Adds writing capability to the {@link Section} class.

- * - *

Please be aware that this class' functionality will be merged into the - * {@link Section} class at a later time, so the API will change.

- * - * @deprecated POI 3.16 - use Section as base class instead - */ -@Removal(version="3.18") -public class MutableSection extends Section { - public MutableSection() {} - - public MutableSection(final Section s) { - super(s); - } - - public MutableSection(final byte[] src, final int offset) throws UnsupportedEncodingException { - super(src,offset); - } -} diff --git a/src/java/org/apache/poi/hpsf/PropertySet.java b/src/java/org/apache/poi/hpsf/PropertySet.java index db01200bc..dd6d7e737 100644 --- a/src/java/org/apache/poi/hpsf/PropertySet.java +++ b/src/java/org/apache/poi/hpsf/PropertySet.java @@ -158,7 +158,7 @@ public class PropertySet { /* Initialize the sections. Since property set must have at least * one section it is added right here. */ - addSection(new MutableSection()); + addSection(new Section()); } @@ -250,7 +250,7 @@ public class PropertySet { setOSVersion(ps.getOSVersion()); setClassID(ps.getClassID()); for (final Section section : ps.getSections()) { - sections.add(new MutableSection(section)); + sections.add(new Section(section)); } } @@ -491,7 +491,7 @@ public class PropertySet { * "offset" accordingly. */ for (int i = 0; i < sectionCount; i++) { - final Section s = new MutableSection(src, o); + final Section s = new Section(src, o); o += ClassID.LENGTH + LittleEndianConsts.INT_SIZE; sections.add(s); } @@ -580,7 +580,7 @@ public class PropertySet { * document. The input stream represents a snapshot of the property set. * If the latter is modified while the input stream is still being * read, the modifications will not be reflected in the input stream but in - * the {@link MutablePropertySet} only. + * the {@link PropertySet} only. * * @return the contents of this property set stream * diff --git a/src/java/org/apache/poi/hpsf/Section.java b/src/java/org/apache/poi/hpsf/Section.java index f04198640..accb177cc 100644 --- a/src/java/org/apache/poi/hpsf/Section.java +++ b/src/java/org/apache/poi/hpsf/Section.java @@ -99,7 +99,7 @@ public class Section { this._offset = -1; setFormatID(s.getFormatID()); for (Property p : s.properties.values()) { - properties.put(p.getID(), new MutableProperty(p)); + properties.put(p.getID(), new Property(p)); } setDictionary(s.getDictionary()); } @@ -228,13 +228,13 @@ public class Section { try { // fix id id = Math.max(PropertyIDMap.PID_MAX, offset2Id.inverseBidiMap().lastKey())+1; - setProperty(new MutableProperty(id, leis, pLen, codepage)); + setProperty(new Property(id, leis, pLen, codepage)); } catch (RuntimeException e) { LOG.log(POILogger.INFO, "Dictionary fallback failed - ignoring property"); } }; } else { - setProperty(new MutableProperty(id, leis, pLen, codepage)); + setProperty(new Property(id, leis, pLen, codepage)); } } @@ -424,7 +424,7 @@ public class Section { */ @SuppressWarnings("deprecation") public void setProperty(final int id, final long variantType, final Object value) { - setProperty(new MutableProperty(id, variantType, value)); + setProperty(new Property(id, variantType, value)); } diff --git a/src/java/org/apache/poi/hpsf/SpecialPropertySet.java b/src/java/org/apache/poi/hpsf/SpecialPropertySet.java deleted file mode 100644 index 0ba19b798..000000000 --- a/src/java/org/apache/poi/hpsf/SpecialPropertySet.java +++ /dev/null @@ -1,49 +0,0 @@ -/* ==================================================================== - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -==================================================================== */ - -package org.apache.poi.hpsf; - -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; - -import org.apache.poi.util.Removal; - -/** - * Interface for the convenience classes {@link SummaryInformation} - * and {@link DocumentSummaryInformation}.

- * - * This used to be an abstract class to support late loading - * of the SummaryInformation classes, as their concrete instance can - * only be determined after the PropertySet has been loaded. - * - * @deprecated POI 3.16 - use PropertySet as base class instead - */ -@Removal(version="3.18") -public class SpecialPropertySet extends MutablePropertySet { - public SpecialPropertySet() { - } - - public SpecialPropertySet(final PropertySet ps) throws UnexpectedPropertySetTypeException { - super(ps); - } - - /* package */ SpecialPropertySet(final InputStream stream) - throws NoPropertySetStreamException, MarkUnsupportedException, IOException, UnsupportedEncodingException { - super(stream); - } -} diff --git a/src/java/org/apache/poi/hpsf/SummaryInformation.java b/src/java/org/apache/poi/hpsf/SummaryInformation.java index 8d9e43179..4425abc53 100644 --- a/src/java/org/apache/poi/hpsf/SummaryInformation.java +++ b/src/java/org/apache/poi/hpsf/SummaryInformation.java @@ -31,7 +31,7 @@ import org.apache.poi.hpsf.wellknown.SectionIDMap; * * @see DocumentSummaryInformation */ -public final class SummaryInformation extends SpecialPropertySet { +public final class SummaryInformation extends PropertySet { /** * The document name a summary information stream usually has in a POIFS filesystem. diff --git a/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java b/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java index 36c3f3a9c..c3efc21d3 100644 --- a/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java +++ b/src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java @@ -28,7 +28,6 @@ import org.apache.poi.hpsf.DocumentSummaryInformation; import org.apache.poi.hpsf.HPSFPropertiesOnlyDocument; import org.apache.poi.hpsf.Property; import org.apache.poi.hpsf.PropertySet; -import org.apache.poi.hpsf.SpecialPropertySet; import org.apache.poi.hpsf.SummaryInformation; import org.apache.poi.hpsf.wellknown.PropertyIDMap; import org.apache.poi.poifs.filesystem.NPOIFSFileSystem; diff --git a/src/java/org/apache/poi/ss/format/CellFormat.java b/src/java/org/apache/poi/ss/format/CellFormat.java index de1bad4bd..8ac807516 100644 --- a/src/java/org/apache/poi/ss/format/CellFormat.java +++ b/src/java/org/apache/poi/ss/format/CellFormat.java @@ -37,7 +37,6 @@ import org.apache.poi.ss.usermodel.DataFormatter; import org.apache.poi.ss.usermodel.DateUtil; import org.apache.poi.ss.util.DateFormatConverter; import org.apache.poi.util.LocaleUtil; -import org.apache.poi.util.Removal; /** * Format a value according to the standard Excel behavior. This "standard" is @@ -118,15 +117,6 @@ public class CellFormat { "###################################################"; private static String QUOTE = "\""; - - /** - * Format a value as it would be were no format specified. This is also - * used when the format specified is General. - * @deprecated use {@link #getInstance(Locale, String)} instead - */ - @Deprecated - @Removal(version="3.18") - public static final CellFormat GENERAL_FORMAT = createGeneralFormat(LocaleUtil.getUserLocale()); private static CellFormat createGeneralFormat(final Locale locale) { return new CellFormat(locale, "General") { diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java index b59b814bd..b913196e4 100644 --- a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java +++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java @@ -49,17 +49,6 @@ public final class ZipHelper { */ private final static String FORWARD_SLASH = "/"; - /** - * Buffer to read data from file. Use big buffer to improve performaces. the - * InputStream class is reading only 8192 bytes per read call (default value - * set by sun) - * - * @deprecated in POI 3.16-beta3, not used anymore - */ - @Deprecated - @Removal(version="3.18") - public static final int READ_WRITE_FILE_BUFFER_SIZE = 8192; - /** * Prevent this class to be instancied. */ diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPartMarshaller.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPartMarshaller.java index 7ef469edc..6836d3c55 100644 --- a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPartMarshaller.java +++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPartMarshaller.java @@ -47,6 +47,7 @@ import org.w3c.dom.Element; */ public final class ZipPartMarshaller implements PartMarshaller { private final static POILogger logger = POILogFactory.getLogger(ZipPartMarshaller.class); + private final static int READ_WRITE_FILE_BUFFER_SIZE = 8192; /** * Save the specified part. @@ -80,7 +81,7 @@ public final class ZipPartMarshaller implements PartMarshaller { // Saving data in the ZIP file InputStream ins = part.getInputStream(); - byte[] buff = new byte[ZipHelper.READ_WRITE_FILE_BUFFER_SIZE]; + byte[] buff = new byte[READ_WRITE_FILE_BUFFER_SIZE]; while (ins.available() > 0) { int resultRead = ins.read(buff); if (resultRead == -1) { diff --git a/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java b/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java index 4ef331f09..911a27b69 100644 --- a/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java +++ b/src/testcases/org/apache/poi/hpsf/basic/TestWrite.java @@ -42,24 +42,7 @@ import java.util.Locale; import java.util.Map; import org.apache.poi.POIDataSamples; -import org.apache.poi.hpsf.ClassID; -import org.apache.poi.hpsf.DocumentSummaryInformation; -import org.apache.poi.hpsf.HPSFException; -import org.apache.poi.hpsf.IllegalPropertySetDataException; -import org.apache.poi.hpsf.MutableProperty; -import org.apache.poi.hpsf.MutablePropertySet; -import org.apache.poi.hpsf.MutableSection; -import org.apache.poi.hpsf.NoFormatIDException; -import org.apache.poi.hpsf.NoPropertySetStreamException; -import org.apache.poi.hpsf.PropertySet; -import org.apache.poi.hpsf.PropertySetFactory; -import org.apache.poi.hpsf.ReadingNotSupportedException; -import org.apache.poi.hpsf.Section; -import org.apache.poi.hpsf.SummaryInformation; -import org.apache.poi.hpsf.UnsupportedVariantTypeException; -import org.apache.poi.hpsf.Variant; -import org.apache.poi.hpsf.VariantSupport; -import org.apache.poi.hpsf.WritingNotSupportedException; +import org.apache.poi.hpsf.*; import org.apache.poi.hpsf.wellknown.PropertyIDMap; import org.apache.poi.hpsf.wellknown.SectionIDMap; import org.apache.poi.poifs.eventfilesystem.POIFSReader; @@ -125,9 +108,9 @@ public class TestWrite { * formatID set: */ final OutputStream out = new FileOutputStream(filename); final POIFSFileSystem poiFs = new POIFSFileSystem(); - final MutablePropertySet ps = new MutablePropertySet(); + final PropertySet ps = new PropertySet(); ps.clearSections(); - ps.addSection(new MutableSection()); + ps.addSection(new Section()); /* Write it to a POIFS and the latter to disk: */ try { @@ -162,8 +145,8 @@ public class TestWrite { /* Create a mutable property set and write it to a POIFS: */ final OutputStream out = new FileOutputStream(filename); final POIFSFileSystem poiFs = new POIFSFileSystem(); - final MutablePropertySet ps = new MutablePropertySet(); - final MutableSection s = (MutableSection) ps.getSections().get(0); + final PropertySet ps = new PropertySet(); + final Section s = ps.getSections().get(0); s.setFormatID(SectionIDMap.SUMMARY_INFORMATION_ID); final ByteArrayOutputStream psStream = new ByteArrayOutputStream(); @@ -209,13 +192,13 @@ public class TestWrite { final OutputStream out = new FileOutputStream(filename); final POIFSFileSystem poiFs = new POIFSFileSystem(); - final MutablePropertySet ps = new MutablePropertySet(); - final MutableSection si = new MutableSection(); + final PropertySet ps = new PropertySet(); + final Section si = new Section(); si.setFormatID(SectionIDMap.SUMMARY_INFORMATION_ID); ps.clearSections(); ps.addSection(si); - final MutableProperty p = new MutableProperty(); + final Property p = new Property(); p.setID(PropertyIDMap.PID_AUTHOR); p.setType(Variant.VT_LPWSTR); p.setValue(AUTHOR); @@ -281,18 +264,18 @@ public class TestWrite { final OutputStream out = new FileOutputStream(filename); final POIFSFileSystem poiFs = new POIFSFileSystem(); - final MutablePropertySet ps = new MutablePropertySet(); + final PropertySet ps = new PropertySet(); ps.clearSections(); final ClassID formatID = new ClassID(); formatID.setBytes(new byte[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}); - final MutableSection s1 = new MutableSection(); + final Section s1 = new Section(); s1.setFormatID(formatID); s1.setProperty(2, SECTION1); ps.addSection(s1); - final MutableSection s2 = new MutableSection(); + final Section s2 = new Section(); s2.setFormatID(formatID); s2.setProperty(2, SECTION2); ps.addSection(s2); @@ -429,10 +412,10 @@ public class TestWrite { @Test public void unicodeWrite8Bit() throws WritingNotSupportedException, IOException, NoPropertySetStreamException { final String TITLE = "This is a sample title"; - final MutablePropertySet mps = new MutablePropertySet(); - final MutableSection ms = (MutableSection) mps.getSections().get(0); + final PropertySet mps = new PropertySet(); + final Section ms = mps.getSections().get(0); ms.setFormatID(SectionIDMap.SUMMARY_INFORMATION_ID); - final MutableProperty p = new MutableProperty(); + final Property p = new Property(); p.setID(PropertyIDMap.PID_TITLE); p.setType(Variant.VT_LPSTR); p.setValue(TITLE); @@ -495,8 +478,8 @@ public class TestWrite { /* Write: */ final OutputStream out = new FileOutputStream(copy); final POIFSFileSystem poiFs = new POIFSFileSystem(); - final MutablePropertySet ps1 = new MutablePropertySet(); - final MutableSection s = (MutableSection) ps1.getSections().get(0); + final PropertySet ps1 = new PropertySet(); + final Section s = ps1.getSections().get(0); final Map m = new HashMap(3, 1.0f); m.put(Long.valueOf(1), "String 1"); m.put(Long.valueOf(2), "String 2"); @@ -759,8 +742,8 @@ public class TestWrite { final OutputStream out = new FileOutputStream(copy); final POIFSFileSystem poiFs = new POIFSFileSystem(); - final MutablePropertySet ps1 = new MutablePropertySet(); - final MutableSection s = (MutableSection) ps1.getSections().get(0); + final PropertySet ps1 = new PropertySet(); + final Section s = ps1.getSections().get(0); final Map m = new HashMap(3, 1.0f); m.put(Long.valueOf(1), "String 1"); m.put(Long.valueOf(2), "String 2"); diff --git a/src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java b/src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java index 4105c223a..cdaa76f66 100644 --- a/src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java +++ b/src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java @@ -34,20 +34,7 @@ import java.util.HashMap; import java.util.Map; import org.apache.poi.POIDataSamples; -import org.apache.poi.hpsf.CustomProperties; -import org.apache.poi.hpsf.CustomProperty; -import org.apache.poi.hpsf.DocumentSummaryInformation; -import org.apache.poi.hpsf.MarkUnsupportedException; -import org.apache.poi.hpsf.MutableProperty; -import org.apache.poi.hpsf.MutableSection; -import org.apache.poi.hpsf.NoPropertySetStreamException; -import org.apache.poi.hpsf.PropertySet; -import org.apache.poi.hpsf.PropertySetFactory; -import org.apache.poi.hpsf.SummaryInformation; -import org.apache.poi.hpsf.UnexpectedPropertySetTypeException; -import org.apache.poi.hpsf.Variant; -import org.apache.poi.hpsf.VariantSupport; -import org.apache.poi.hpsf.WritingNotSupportedException; +import org.apache.poi.hpsf.*; import org.apache.poi.hpsf.wellknown.SectionIDMap; import org.apache.poi.poifs.filesystem.DocumentInputStream; import org.apache.poi.poifs.filesystem.NPOIFSFileSystem; @@ -567,14 +554,14 @@ public class TestWriteWellKnown { DocumentSummaryInformation dsi = PropertySetFactory.newDocumentSummaryInformation(); CustomProperties cps; - MutableSection s; + Section s; /* A document summary information set stream by default does have custom properties. */ cps = dsi.getCustomProperties(); assertNull(cps); /* Test an empty custom properties set. */ - s = new MutableSection(); + s = new Section(); s.setFormatID(SectionIDMap.DOCUMENT_SUMMARY_INFORMATION_ID[1]); // s.setCodepage(CodePageUtil.CP_UNICODE); dsi.addSection(s); @@ -582,7 +569,7 @@ public class TestWriteWellKnown { assertEquals(0, cps.size()); /* Add a custom property. */ - MutableProperty p = new MutableProperty(); + Property p = new Property(); p.setID(ID_1); p.setType(Variant.VT_LPWSTR); p.setValue(VALUE_1);