Package org.apache.sling.jcr.contentloader.internal.readers

# Class ZipReader

java.lang.Object
org.apache.sling.jcr.contentloader.internal.readers.ZipReader

All Implemented Interfaces:
  `ContentReader`

public class ZipReader extends Object implements ContentReader
The `ZipReader`

Since:
  2.0.4

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static @interface`
`ZipReader.Config`

## Field Summary

### Fields inherited from interface org.apache.sling.jcr.contentloader.ContentReader

`PROPERTY_EXTENSIONS, PROPERTY_TYPES`

## Constructor Summary

Constructors
Constructor
Description
`ZipReader()`

## Method Summary

Modifier and Type
Method
Description
`protected int`
`copyZipEntryToTempFile(File tempFile, ZipInputStream zis, ZipEntry entry, int totalSizeArchive, int totalEntryArchive)`
Copy the contents of a zip entry to a temp file and check the entry contents against the configured threshold for violations
`void`
`parse(InputStream ins, ContentCreator creator)`
Read the content from the input stream and create the content using the provided content creator.
`void`
`parse(URL url, ContentCreator creator)`
Read the content from the URL and create the content using the provided content creator.

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

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

## Constructor Details

### ZipReader

public ZipReader()

## Method Details

### parse

public void parse(URL url, ContentCreator creator) throws IOException, javax.jcr.RepositoryException
Description copied from interface: `ContentReader`
Read the content from the URL and create the content using the provided content creator.

Specified by:
  `parse` in interface `ContentReader`
Parameters:
  `url` - The input stream.
Throws:
  `IOException` - If anything goes wrong.
  `javax.jcr.RepositoryException`
See Also:
  - `ContentReader.parse(java.net.URL, org.apache.sling.jcr.contentloader.ContentCreator)`

### parse

public void parse(InputStream ins, ContentCreator creator) throws IOException, javax.jcr.RepositoryException
Description copied from interface: `ContentReader`
Read the content from the input stream and create the content using the provided content creator.

Specified by:
  `parse` in interface `ContentReader`
Parameters:
  `ins` - the input stream.
Throws:
  `IOException` - If anything goes wrong.
  `javax.jcr.RepositoryException`
See Also:
  - `ContentReader.parse(java.io.InputStream, org.apache.sling.jcr.contentloader.ContentCreator)`

### copyZipEntryToTempFile

protected int copyZipEntryToTempFile(File tempFile, ZipInputStream zis, ZipEntry entry, int totalSizeArchive, int totalEntryArchive) throws IOException
Copy the contents of a zip entry to a temp file and check the entry contents against the configured threshold for violations

Parameters:
  `tempFile` - the temp file to write the entry to
  `zis` - the input stream for the zip file we are processing
  `entry` - the current zip entry
  `totalSizeArchive` - the total size of the archive so far
  `totalEntryArchive` - the total number of entries so far
Returns:
  the new totalSizeArchive value after reading the entry
Throws:
  `IOException`