ewe.io
Class EweFile
java.lang.Object
ewe.io.EweFile
- public class EweFile
- extends Object
A EweFile represents a formatted ".ewe" file. Like a ewe.zip.ZipFile it can be used
to browse the contents of a ZipFile.
While there are methods to list and read the entries
of a EweFile it is probably more useful to create a EweEntryFile object for the EweFile.
This file is a type of ewe.io.File and so can be used to browse, list and even read the
contents of the EweFile as if it were an ordinary file. You create a EweEntryFile by first
creating the EweFile object, given a RandomAccessStream that reads the EweFileBytes
and then calling one of the EweEntryFile constructors. This makes that constructed EweEntryFile
represent the root directory of the EweFile and you can then call getChild() or list() on that
root file to browse the contents of the EweFile.
eweName
public String eweName
eweIcon
public static IImage eweIcon
entries
protected Vector entries
root
public EweFile.EweEntry root
EweFile
public EweFile(RandomAccessStream stream,
Handle handle)
EweFile
public EweFile(RandomAccessStream stream)
throws IOException
EweFile
public EweFile(File f)
throws IOException
findEntry
public EweFile.EweEntry findEntry(String name)
- Find a named entry.
- Parameters:
name - The case sensitive name to look for.
- Returns:
- the EweEntry if found, null if not.
getInputStream
public static Stream getInputStream(RandomAccessStream eweStream,
String name,
boolean singleUse)
throws IOException
- Get a Stream that can be used for reading a single entry from a RandomAccessStream that
represents a Ewe file.
- Parameters:
eweStream - An open Ewe file.name - the entry to lok for.singleUse - if this is true, then closing the returned input stream will close the eweStream as well.
- Returns:
- a Stream for reading.
- Throws:
IOException - if the ewe file is not formatted correctly.
getSingleImage
public static Image getSingleImage(RandomAccessStream eweStream,
String baseName,
boolean isMask)
getImageAndMask
public static IImage getImageAndMask(RandomAccessStream eweStream,
String baseName)
readEntries
protected void readEntries(Handle handle,
String lookFor)
throws IOException
- Throws:
IOException
close
public void close()
getInputStream
public Stream getInputStream(EweFile.EweEntry entry)
getEntries
public Iterator getEntries()
- Get an Iterator for the entries in the EweFile.
isOpen
public boolean isOpen()
getEweEntryFile
public EweFile.EweEntryFile getEweEntryFile(Handle h)