com.ibm.jzos.sample
Class ZipDatasetSource
- java.lang.Object
-
- com.ibm.jzos.sample.ZipDatasetSource
-
public class ZipDatasetSource extends java.lang.Object
A class that is used byZipDatasets
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)
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:
ZipDatasets the main class used to zip z/OS datasets
,addTo(ZipOutputStream, String)
-
-
Constructor Summary
Constructors Constructor and Description ZipDatasetSource(java.lang.String nm)
Construct an instance given a dataset/pattern name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
addTo(java.util.zip.ZipOutputStream zipOutStream, java.lang.String targetEncoding)
Add one or more entries to the given ZipOutputStream for the dataset or datasets described by this ZipDatasetSource.java.lang.String
getName()
Answer the dataset/pattern name.
-
-
-
Constructor Detail
-
ZipDatasetSource
public ZipDatasetSource(java.lang.String nm)
Construct an instance given a dataset/pattern name. We also convert the name to uppercase and drop any "//" prefix.
-
-
Method Detail
-
getName
public java.lang.String getName()
Answer the dataset/pattern name.
-
addTo
public void addTo(java.util.zip.ZipOutputStream zipOutStream, java.lang.String targetEncoding) throws java.io.IOException
Add one or more entries to the given ZipOutputStream for the dataset or datasets described by this ZipDatasetSource.- Parameters:
zipOutStream
- the output ZipOutputStreamtargetEncoding
- the codepage used to encode the data written to the zipOutStream- Throws:
java.io.IOException
-
-