Class ZipDatasetSource

java.lang.Object
com.ibm.jzos.sample.ZipDatasetSource

public class ZipDatasetSource extends Object
A class that is used by ZipDatasets to handle the creation of zip file entries for z/OS datasets.

Instances of this class are constructed using a dataset name or pattern, which can include:

  • A sequential dataset or PDS name: //A.B.C
  • A dataset pattern name: //A.*.D as defined by the z/OS Catalog Search facility (IGGCSI00). See CatalogSearch for more information.
  • A PDS member name: //A.B.C(MEM)
  • A PDS member pattern: //A.B.C(D*X)
  • A DD name: //DD:XYZ which might refer to a sequential dataset, or PDS, or concatenation.
  • A DD name and member: //DD:XYZ(MEM)
  • A DD name and member pattern: //DD:XYZ(D*X)
The leading "//" prefix may be omitted and names are case insensitive.

Each dataset is zipped to the ZipOutputStream by reading the source dataset as text encoded in the default EBCDIC codepage (ZUtil.getDefaultPlatformEncoding()) and then writing the text to ZipOutputStream encoded using the supplied target encoding.

The name given to each entry is the actual MVS dataset name in upper case. If the entry is for a PDS member, then the dataset name is used as a directory name followed by the member name as a file name.

Since:
2.3.0
See Also:
  • Constructor Details

    • ZipDatasetSource

      public ZipDatasetSource(String nm)
      Construct an instance given a dataset/pattern name. We also convert the name to uppercase and drop any "//" prefix.
  • Method Details

    • getName

      public String getName()
      Answer the dataset/pattern name.
    • addTo

      public void addTo(ZipOutputStream zipOutStream, String targetEncoding) throws IOException
      Add one or more entries to the given ZipOutputStream for the dataset or datasets described by this ZipDatasetSource.

      Parameters:
      zipOutStream - the output ZipOutputStream
      targetEncoding - the codepage used to encode the data written to the zipOutStream
      Throws:
      IOException