]> source.dussan.org Git - poi.git/commitdiff
remove some deprecated code slated for removal in 3.18
authorPJ Fanning <fanningpj@apache.org>
Thu, 14 Sep 2017 23:44:47 +0000 (23:44 +0000)
committerPJ Fanning <fanningpj@apache.org>
Thu, 14 Sep 2017 23:44:47 +0000 (23:44 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808403 13f79535-47bb-0310-9956-ffa450edef68

19 files changed:
src/examples/src/org/apache/poi/hpsf/examples/CopyCompare.java
src/examples/src/org/apache/poi/hpsf/examples/WriteAuthorAndTitle.java
src/examples/src/org/apache/poi/hpsf/examples/WriteTitle.java
src/java/org/apache/poi/hpsf/CustomProperties.java
src/java/org/apache/poi/hpsf/CustomProperty.java
src/java/org/apache/poi/hpsf/DocumentSummaryInformation.java
src/java/org/apache/poi/hpsf/MutableProperty.java [deleted file]
src/java/org/apache/poi/hpsf/MutablePropertySet.java [deleted file]
src/java/org/apache/poi/hpsf/MutableSection.java [deleted file]
src/java/org/apache/poi/hpsf/PropertySet.java
src/java/org/apache/poi/hpsf/Section.java
src/java/org/apache/poi/hpsf/SpecialPropertySet.java [deleted file]
src/java/org/apache/poi/hpsf/SummaryInformation.java
src/java/org/apache/poi/hpsf/extractor/HPSFPropertiesExtractor.java
src/java/org/apache/poi/ss/format/CellFormat.java
src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ZipHelper.java
src/ooxml/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPartMarshaller.java
src/testcases/org/apache/poi/hpsf/basic/TestWrite.java
src/testcases/org/apache/poi/hpsf/basic/TestWriteWellKnown.java

index f30dc8be0ef76685f4480a7fd0de41ef56bef022..b5bc87562367ec2624a52eb5f609664f6cf72211 100644 (file)
@@ -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;
  * 
  * <p>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.</p>
  * 
@@ -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.</p>
+     * PropertySet#PropertySet(PropertySet)} constructor.</p>
      */
     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());
         }
 
index e5454aa93cbabe4e8cc78a4b13ccc70f5205dfc7..af0042e43a52acf455cff1be19a3322b23103aff 100644 (file)
@@ -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());
         }
 
index 4323ce242f24509293a6ce8f29d47eed758ac4ec..464f958b38f298fa4f25a9a08e61acec41070c59 100644 (file)
@@ -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. */
index da4e9277bc29bf44aed52e835690be43285e41d8..8652c3a44688af14633f2db756aac5e6521e596e 100644 (file)
@@ -151,7 +151,7 @@ public class CustomProperties implements Map<String,Object> {
         } 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));
     }
     
index 83511655abaa2ea991f5365976aaa777be672621..9602cf8f4921b8b455601218f0b8cdfa84171822 100644 (file)
@@ -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;
index cea4d5dd9fc0d020774b326691e2fc82d4e479fe..7d86a2b0f3ee7cf8d873d623f4f18810078c01a4 100644 (file)
@@ -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 (file)
index 106ad6f..0000000
+++ /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;
-
-/**
- * <p>Adds writing capability to the {@link Property} class.</p>
- *
- * <p>Please be aware that this class' functionality will be merged into the
- * {@link Property} class at a later time, so the API will change.</p>
- * 
- * @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 (file)
index 60f043a..0000000
+++ /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.<p>
- *
- * 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 (file)
index c5f0d6e..0000000
+++ /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;
-
-/**
- * <p>Adds writing capability to the {@link Section} class.</p>
- *
- * <p>Please be aware that this class' functionality will be merged into the
- * {@link Section} class at a later time, so the API will change.</p>
- *
- * @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);
-    }
-}
index db01200bc7742ede7eb2e6c550d0e4641848c2ce..dd6d7e737fcfe89d200f5d59c03be4177c9befd6 100644 (file)
@@ -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
      *
index f0419864022e463cd436c1d593fd9ca0d2dd60bf..accb177cc6373d64811d19e13e770abb8624e05e 100644 (file)
@@ -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 (file)
index 0ba19b7..0000000
+++ /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}.<p>
- *
- * 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);
-    }
-}
index 8d9e4317941403499f944b06fead2687b299cdb9..4425abc5306e9edb71c1d2633776107fa8af10d4 100644 (file)
@@ -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.
index 36c3f3a9cb67dc9cc9ee6cae18ba6f475e826205..c3efc21d3db40799a7eff34feeddc888e22f8620 100644 (file)
@@ -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;
index de1bad4bd3013409523bcf1434fb842d63511e7f..8ac807516630a8e3fb6c940b0ec175f95a253bc9 100644 (file)
@@ -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 <tt>General</tt>.
-     * @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") {
index b59b814bd3ff87461be88052ea8095e2bb6a5de1..b913196e4a42cd92da993d2d928c86ebee2e741b 100644 (file)
@@ -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.
      */
index 7ef469edcd776f3338f438f4682fabf355ca79ea..6836d3c55a4aeddcdd64d9317a8735a7ba9b96a5 100644 (file)
@@ -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) {
index 4ef331f09e117f99eb55da9b1a49ba321a5c2ff1..911a27b699e5b649beb3c6f0f8736c6016d1e2dd 100644 (file)
@@ -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<Long,String> m = new HashMap<Long,String>(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<Long,String> m = new HashMap<Long, String>(3, 1.0f);
         m.put(Long.valueOf(1), "String 1");
         m.put(Long.valueOf(2), "String 2");
index 4105c223a8a5b3dccc2c64ee9731d83dbc392ec4..cdaa76f660ff58a20072abb3d4408f91147e9ce9 100644 (file)
@@ -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);