Package org.apache.openjpa.lib.meta
Class ZipFileMetaDataIterator
- java.lang.Object
-
- org.apache.openjpa.lib.meta.ZipFileMetaDataIterator
-
- All Implemented Interfaces:
MetaDataFilter.Resource
,MetaDataIterator
,Closeable
public class ZipFileMetaDataIterator extends java.lang.Object implements MetaDataIterator, MetaDataFilter.Resource
Iterator over all metadata resources in a given zip file.- Author:
- Abe White
-
-
Constructor Summary
Constructors Constructor Description ZipFileMetaDataIterator(java.net.URL url, MetaDataFilter filter)
Constructor; supply zip/jar URL and optional file filter.ZipFileMetaDataIterator(java.util.zip.ZipFile file, MetaDataFilter filter)
Constructor; supply zip file and optional file filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the resources used by this iterator.byte[]
getContent()
Resource content.java.io.File
getFile()
Return the last-iterated metadata resource content as a file, or null if not an extant file.java.io.InputStream
getInputStream()
Return the last-iterated metadata resource content as a stream.java.lang.String
getName()
The name of the resource.boolean
hasNext()
Return whether there is another resource to iterate over.java.lang.String
next()
Return the next metadata resource.
-
-
-
Constructor Detail
-
ZipFileMetaDataIterator
public ZipFileMetaDataIterator(java.net.URL url, MetaDataFilter filter) throws java.io.IOException
Constructor; supply zip/jar URL and optional file filter.- Throws:
java.io.IOException
-
ZipFileMetaDataIterator
public ZipFileMetaDataIterator(java.util.zip.ZipFile file, MetaDataFilter filter)
Constructor; supply zip file and optional file filter.
-
-
Method Detail
-
hasNext
public boolean hasNext() throws java.io.IOException
Description copied from interface:MetaDataIterator
Return whether there is another resource to iterate over.- Specified by:
hasNext
in interfaceMetaDataIterator
- Throws:
java.io.IOException
-
next
public java.lang.String next() throws java.io.IOException
Description copied from interface:MetaDataIterator
Return the next metadata resource.- Specified by:
next
in interfaceMetaDataIterator
- Throws:
java.io.IOException
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException
Description copied from interface:MetaDataIterator
Return the last-iterated metadata resource content as a stream.- Specified by:
getInputStream
in interfaceMetaDataIterator
- Throws:
java.io.IOException
-
getFile
public java.io.File getFile()
Description copied from interface:MetaDataIterator
Return the last-iterated metadata resource content as a file, or null if not an extant file.- Specified by:
getFile
in interfaceMetaDataIterator
-
close
public void close()
Description copied from interface:MetaDataIterator
Close the resources used by this iterator.- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceMetaDataIterator
-
getName
public java.lang.String getName()
Description copied from interface:MetaDataFilter.Resource
The name of the resource.- Specified by:
getName
in interfaceMetaDataFilter.Resource
-
getContent
public byte[] getContent() throws java.io.IOException
Description copied from interface:MetaDataFilter.Resource
Resource content.- Specified by:
getContent
in interfaceMetaDataFilter.Resource
- Throws:
java.io.IOException
-
-