org.apache.poi.ooxml

## Class POIXMLRelation

- java.lang.Object
- - org.apache.poi.ooxml.POIXMLRelation

- Direct Known Subclasses:
    DSigRelation, XDGFRelation, XSLFRelation, XSSFBRelation, XSSFRelation, XWPFRelation

      public abstract class POIXMLRelation
      extends java.lang.Object

  Represents a descriptor of a OOXML relation.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `POIXMLRelation.NoArgConstructor`
    `static interface` | `POIXMLRelation.PackagePartConstructor`
    `static interface` | `POIXMLRelation.ParentPartConstructor`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `POIXMLRelation(java.lang.String type, java.lang.String rel, java.lang.String defaultName)` Instantiates a POIXMLRelation.
    `protected` | `POIXMLRelation(java.lang.String type, java.lang.String rel, java.lang.String defaultName, POIXMLRelation.NoArgConstructor noArgConstructor, POIXMLRelation.PackagePartConstructor packagePartConstructor, POIXMLRelation.ParentPartConstructor parentPartConstructor)` Instantiates a POIXMLRelation.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.io.InputStream` | `getContents(PackagePart corePart)` Fetches the InputStream to read the contents, based of the specified core part, for which we are defined as a suitable relationship
    `java.lang.String` | `getContentType()` Return the content type.
    `java.lang.String` | `getDefaultFileName()` Return the default part name.
    `java.lang.String` | `getFileName(int index)` Returns the filename for the nth one of these, e.g.
    `java.lang.Integer` | `getFileNameIndex(POIXMLDocumentPart part)` Returns the index of the filename within the package for the given part.
    `POIXMLRelation.NoArgConstructor` | `getNoArgConstructor()`
    `POIXMLRelation.PackagePartConstructor` | `getPackagePartConstructor()`
    `POIXMLRelation.ParentPartConstructor` | `getParentPartConstructor()`
    `java.lang.String` | `getRelation()` Return the relationship, the kind of connection between a source part and a target part in a package.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### POIXMLRelation

          protected POIXMLRelation(java.lang.String type,
                                   java.lang.String rel,
                                   java.lang.String defaultName,
                                   POIXMLRelation.NoArgConstructor noArgConstructor,
                                   POIXMLRelation.PackagePartConstructor packagePartConstructor,
                                   POIXMLRelation.ParentPartConstructor parentPartConstructor)

      Instantiates a POIXMLRelation.
      Parameters:
        `type` - content type
        `rel` - relationship
        `defaultName` - default item name
        `noArgConstructor` - method used to construct instances of this relationship from scratch
        `packagePartConstructor` - method used to construct instances of this relationship with a package part

    - #### POIXMLRelation

          protected POIXMLRelation(java.lang.String type,
                                   java.lang.String rel,
                                   java.lang.String defaultName)

      Instantiates a POIXMLRelation.
      Parameters:
        `type` - content type
        `rel` - relationship
        `defaultName` - default item name

  - ### Method Detail

    - #### getContentType

          public java.lang.String getContentType()

      Return the content type. Content types define a media type, a subtype, and an optional set of parameters, as defined in RFC 2616.
      Returns:
        the content type

    - #### getRelation

          public java.lang.String getRelation()

      Return the relationship, the kind of connection between a source part and a target part in a package. Relationships make the connections between parts directly discoverable without looking at the content in the parts, and without altering the parts themselves.
      Returns:
        the relationship

    - #### getDefaultFileName

          public java.lang.String getDefaultFileName()

      Return the default part name. Part names are used to refer to a part in the context of a package, typically as part of a URI.
      Returns:
        the default part name

    - #### getFileName

          public java.lang.String getFileName(int index)

      Returns the filename for the nth one of these, e.g. /xl/comments4.xml
      Parameters:
        `index` - the suffix for the document type
      Returns:
        the filename including the suffix

    - #### getFileNameIndex

          public java.lang.Integer getFileNameIndex(POIXMLDocumentPart part)

      Returns the index of the filename within the package for the given part. e.g. 4 for /xl/comments4.xml
      Parameters:
        `part` - the part to read the suffix from
      Returns:
        the suffix

    - #### getNoArgConstructor

          public POIXMLRelation.NoArgConstructor getNoArgConstructor()

      Returns:
        the constructor method used to construct instances of this relationship from scratch
      Since:
        4.1.2

    - #### getPackagePartConstructor

          public POIXMLRelation.PackagePartConstructor getPackagePartConstructor()

      Returns:
        the constructor method used to construct instances of this relationship with a package part
      Since:
        4.1.2

    - #### getParentPartConstructor

          public POIXMLRelation.ParentPartConstructor getParentPartConstructor()

      Returns:
        the constructor method used to construct instances of this relationship with a package part
      Since:
        4.1.2

    - #### getContents

          public java.io.InputStream getContents(PackagePart corePart)
                                          throws java.io.IOException,
                                                 InvalidFormatException

      Fetches the InputStream to read the contents, based of the specified core part, for which we are defined as a suitable relationship
      Throws:
        `java.io.IOException`
        `InvalidFormatException`
      Since:
        3.16-beta3

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.