From: PJ Fanning 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.
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 60f043af9f..0000000000 --- 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 c5f0d6e0c8..0000000000 --- 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 db01200bc7..dd6d7e737f 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 f041986402..accb177cc6 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 0ba19b7982..0000000000 --- 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 8d9e431794..4425abc530 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 36c3f3a9cb..c3efc21d3d 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 de1bad4bd3..8ac8075166 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 b59b814bd3..b913196e4a 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 7ef469edcd..6836d3c55a 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 4ef331f09e..911a27b699 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