}
public static void loadEmbedded(XSSFWorkbook workbook) throws IOException, InvalidFormatException, OpenXML4JException, XmlException {
- for (PackagePart pPart : workbook.getAllEmbedds()) {
+ for (PackagePart pPart : workbook.getAllEmbeddedParts()) {
String contentType = pPart.getContentType();
if (contentType.equals("application/vnd.ms-excel")) {
// Excel Workbook - either binary or OpenXML
is.close();
// Get the document's embedded files.
- for (PackagePart p : ppt.getAllEmbedds()) {
+ for (PackagePart p : ppt.getAllEmbeddedParts()) {
String type = p.getContentType();
// typically file name
String name = p.getPartName().getName();
public class EmbeddedObjects {
public static void main(String[] args) throws Exception {
try (XSSFWorkbook workbook = new XSSFWorkbook(args[0])) {
- for (PackagePart pPart : workbook.getAllEmbedds()) {
+ for (PackagePart pPart : workbook.getAllEmbeddedParts()) {
String contentType = pPart.getContentType();
try (InputStream is = pPart.getInputStream()) {
Closeable document;
* file system.
*/
public void updateEmbeddedDoc() throws OpenXML4JException, IOException {
- List<PackagePart> embeddedDocs = this.doc.getAllEmbedds();
+ List<PackagePart> embeddedDocs = this.doc.getAllEmbeddedParts();
for (PackagePart pPart : embeddedDocs) {
String ext = pPart.getPartName().getExtension();
if (BINARY_EXTENSION.equals(ext) || OPENXML_EXTENSION.equals(ext)) {
* file system.
*/
public void checkUpdatedDoc() throws OpenXML4JException, IOException {
- for (PackagePart pPart : this.doc.getAllEmbedds()) {
+ for (PackagePart pPart : this.doc.getAllEmbeddedParts()) {
String ext = pPart.getPartName().getExtension();
if (BINARY_EXTENSION.equals(ext) || OPENXML_EXTENSION.equals(ext)) {
try (InputStream is = pPart.getInputStream();
public final class POIXMLDocumentHandler {
protected void handlePOIXMLDocument(POIXMLDocument doc) throws Exception {
- assertNotNull(doc.getAllEmbedds());
+ assertNotNull(doc.getAllEmbeds());
assertNotNull(doc.getPackage());
assertNotNull(doc.getPackagePart());
assertNotNull(doc.getProperties());
import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
+import org.apache.poi.util.Removal;
import org.apache.xmlbeans.impl.common.SystemCache;
/**
* Get the document's embedded files.
*
* @return the document's embedded files
- *
+ *
+ * @throws OpenXML4JException if the embedded parts can't be determined
+ * @deprecated use <code>getAllEmbeddedParts</code> instead
+ */
+ @Deprecated
+ @Removal(version = "4.2")
+ public List<PackagePart> getAllEmbedds() throws OpenXML4JException {
+ return getAllEmbeddedParts();
+ }
+
+ /**
+ * Get the document's embedded files.
+ *
+ * @return the document's embedded files
+ *
* @throws OpenXML4JException if the embedded parts can't be determined
+ * @since POI 4.0.0
*/
- public abstract List<PackagePart> getAllEmbedds() throws OpenXML4JException;
+ public abstract List<PackagePart> getAllEmbeddedParts() throws OpenXML4JException;
protected final void load(POIXMLFactory factory) throws IOException {
Map<PackagePart, POIXMLDocumentPart> context = new HashMap<>();
* Not currently implemented
*/
@Override
- public List<PackagePart> getAllEmbedds() {
+ public List<PackagePart> getAllEmbeddedParts() {
return new ArrayList<>();
}
* Get the document's embedded files.
*/
@Override
- public List<PackagePart> getAllEmbedds() throws OpenXML4JException {
+ public List<PackagePart> getAllEmbeddedParts() throws OpenXML4JException {
return Collections.unmodifiableList(
getPackage().getPartsByName(Pattern.compile("/ppt/embeddings/.*?"))
);
* Get the document's embedded files.
*/
@Override
- public List<PackagePart> getAllEmbedds() throws OpenXML4JException {
+ public List<PackagePart> getAllEmbeddedParts() throws OpenXML4JException {
return embedds;
}
* Get the document's embedded files.
*/
@Override
- public List<PackagePart> getAllEmbedds() throws OpenXML4JException {
+ public List<PackagePart> getAllEmbeddedParts() throws OpenXML4JException {
List<PackagePart> embedds = new LinkedList<>();
for(XSSFSheet sheet : sheets){
* Get the document's embedded files.
*/
@Override
- public List<PackagePart> getAllEmbedds() throws OpenXML4JException {
+ public List<PackagePart> getAllEmbeddedParts() throws OpenXML4JException {
List<PackagePart> embedds = new LinkedList<>();
// Get the embeddings for the workbook
}
private void test(POIXMLDocument doc, int expectedCount) throws Exception {
- assertNotNull(doc.getAllEmbedds());
- assertEquals(expectedCount, doc.getAllEmbedds().size());
+ assertNotNull(doc.getAllEmbeddedParts());
+ assertEquals(expectedCount, doc.getAllEmbeddedParts().size());
- for(int i=0; i<doc.getAllEmbedds().size(); i++) {
- PackagePart pp = doc.getAllEmbedds().get(i);
+ for(int i=0; i<doc.getAllEmbeddedParts().size(); i++) {
+ PackagePart pp = doc.getAllEmbeddedParts().get(i);
assertNotNull(pp);
byte[] b = IOUtils.toByteArray(pp.getInputStream());
}
@Override
- public List<PackagePart> getAllEmbedds() {
+ public List<PackagePart> getAllEmbeddedParts() {
throw new RuntimeException("not supported");
}