sam.core
Class ArchiveLayout.Resource

java.lang.Object
  |
  +--sam.core.ArchiveLayout.Resource
Direct Known Subclasses:
ArchiveLayout.LayoutVersion, ArchiveLayout.Runtime
Enclosing class:
ArchiveLayout

public static class ArchiveLayout.Resource
extends java.lang.Object

Specific resources in the jar archive.


Field Summary
protected  int compressionMethod
          The preferred compression method for this resource
 boolean isOptionnal
          Wether this resource must always be present in the archive
 java.lang.String name
          The entry name of this resource
 java.lang.String title
          A human-readable description of this resource
 
Method Summary
 java.io.InputStream get()
          Opens this Resource from the boot-time jar file assumed to be the archive
 java.io.InputStream get(java.util.zip.ZipFile archive)
          Opens this Resource from specified archive
 byte[] getBytes(java.util.zip.ZipFile archive)
          Reads this Resource as a byte[] array
 int getInt(java.util.zip.ZipFile archive)
          Reads this Resource as a int number
 long getLong(java.util.zip.ZipFile archive)
          Reads this Resource as a long number
 java.lang.String getString(java.util.zip.ZipFile archive)
          Reads this Resource as a String
 java.lang.String[] getStrings(java.util.zip.ZipFile archive)
          Reads this Resource line-by-line as a String[] array
 java.io.OutputStream put(java.util.jar.JarOutputStream jar)
          Opens this Resource from specified archive
 void putBytes(byte[] content, java.util.jar.JarOutputStream jar)
          Writes this Resource line-by-line as a byte[] array
 void putInputStream(java.io.InputStream content, java.util.jar.JarOutputStream jar)
          Writes this Resource as an InputStream
 void putInt(int content, java.util.jar.JarOutputStream jar)
          Writes this Resource as a int number
 void putLong(long content, java.util.jar.JarOutputStream jar)
          Writes this Resource as a long number
 void putString(java.lang.String content, java.util.jar.JarOutputStream jar)
          Writes this Resource as a String
 void putStrings(java.lang.String[] content, java.util.jar.JarOutputStream jar)
          Writes this Resource line-by-line as a String[] array
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public final java.lang.String name
The entry name of this resource


title

public final java.lang.String title
A human-readable description of this resource


isOptionnal

public final boolean isOptionnal
Wether this resource must always be present in the archive


compressionMethod

protected final int compressionMethod
The preferred compression method for this resource

See Also:
java.util.zip.Zip.ZipEntry
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

get

public java.io.InputStream get()
                        throws java.io.IOException
Opens this Resource from the boot-time jar file assumed to be the archive

java.io.IOException

get

public java.io.InputStream get(java.util.zip.ZipFile archive)
                        throws java.io.IOException
Opens this Resource from specified archive

Parameters:
archive - the archive to read from
java.io.IOException

getString

public java.lang.String getString(java.util.zip.ZipFile archive)
Reads this Resource as a String

Parameters:
archive - the archive to read from
Returns:
null in case of I/O error

getStrings

public java.lang.String[] getStrings(java.util.zip.ZipFile archive)
Reads this Resource line-by-line as a String[] array

Parameters:
archive - the archive to read from
Returns:
new String[0] in case of I/O error

getLong

public long getLong(java.util.zip.ZipFile archive)
             throws java.lang.NumberFormatException
Reads this Resource as a long number

Parameters:
archive - the archive to read from
Returns:
0 in case of I/O error
java.lang.NumberFormatException

getInt

public int getInt(java.util.zip.ZipFile archive)
           throws java.lang.NumberFormatException
Reads this Resource as a int number

Parameters:
archive - the archive to read from
Returns:
0 in case of I/O error
java.lang.NumberFormatException

getBytes

public byte[] getBytes(java.util.zip.ZipFile archive)
Reads this Resource as a byte[] array

Parameters:
archive - the archive to read from
Returns:
null in case of I/O error

put

public java.io.OutputStream put(java.util.jar.JarOutputStream jar)
Opens this Resource from specified archive


putLong

public void putLong(long content,
                    java.util.jar.JarOutputStream jar)
Writes this Resource as a long number


putInt

public void putInt(int content,
                   java.util.jar.JarOutputStream jar)
Writes this Resource as a int number


putString

public void putString(java.lang.String content,
                      java.util.jar.JarOutputStream jar)
Writes this Resource as a String


putStrings

public void putStrings(java.lang.String[] content,
                       java.util.jar.JarOutputStream jar)
Writes this Resource line-by-line as a String[] array


putInputStream

public void putInputStream(java.io.InputStream content,
                           java.util.jar.JarOutputStream jar)
Writes this Resource as an InputStream


putBytes

public void putBytes(byte[] content,
                     java.util.jar.JarOutputStream jar)
Writes this Resource line-by-line as a byte[] array