com.sun.jini.tool
Class JarWrapper.PreferredListWriter

java.lang.Object
  extended by com.sun.jini.tool.JarWrapper.PreferredListWriter
Enclosing class:
JarWrapper

private static class JarWrapper.PreferredListWriter
extends Object

Compiles and writes combined preferred lists.


Nested Class Summary
private  class JarWrapper.PreferredListWriter.DirNode
          Represents JAR-internal directory.
private static class JarWrapper.PreferredListWriter.FileNode
          Stores file preference state.
 
Field Summary
private  List apiClasses
           
private static int FALSE_LEN
           
private static int NAME_LEN
           
private static int NEWLINE_LEN
           
private  int numPrefs
           
private  HashMap pathMap
           
private static int PREFERRED_LEN
           
private  JarWrapper.PreferredListWriter.DirNode rootNode
           
private static int TRUE_LEN
           
 
Constructor Summary
JarWrapper.PreferredListWriter(List apiClasses)
          Constructs a PreferredListWriter.
 
Method Summary
(package private)  void addEntries(JarFile jar, JarWrapper.PreferredListReader prefReader)
          Records preferred status of each file entry in the given JAR file, determined using the provided preferred list reader.
private  void addFile(String path, String jarFileName, boolean preferred)
          Records the preferred setting of the given file entry.
(package private) static int calcEntryLength(String name, boolean pref)
          Returns the number of characters needed to write a preferred list entry with the given name and preferred setting.
(package private) static int min(int i1, int i2, int i3)
           
private static String parentPath(String path)
          Returns path of the parent directory of the indicated JAR entry.
(package private)  void write(JarOutputStream jout)
          Writes minimal combined preferred list to given output stream.
(package private) static void writeEntry(Writer w, String name, boolean pref)
          Writes preferred list entry with the given name and preferred setting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME_LEN

private static final int NAME_LEN

PREFERRED_LEN

private static final int PREFERRED_LEN

TRUE_LEN

private static final int TRUE_LEN

FALSE_LEN

private static final int FALSE_LEN

NEWLINE_LEN

private static final int NEWLINE_LEN

pathMap

private final HashMap pathMap

rootNode

private final JarWrapper.PreferredListWriter.DirNode rootNode

numPrefs

private int numPrefs

apiClasses

private final List apiClasses
Constructor Detail

JarWrapper.PreferredListWriter

JarWrapper.PreferredListWriter(List apiClasses)
Constructs a PreferredListWriter.

Parameters:
apiClasses - list of URI paths representing classes that must be considered API classes in case a preferences conflict arrises during wrapping of JAR files
Method Detail

addEntries

void addEntries(JarFile jar,
                JarWrapper.PreferredListReader prefReader)
          throws IOException
Records preferred status of each file entry in the given JAR file, determined using the provided preferred list reader.

Throws:
IOException

write

void write(JarOutputStream jout)
     throws IOException
Writes minimal combined preferred list to given output stream.

Throws:
IOException

addFile

private void addFile(String path,
                     String jarFileName,
                     boolean preferred)
              throws IOException
Records the preferred setting of the given file entry.

Throws:
IOException

parentPath

private static String parentPath(String path)
Returns path of the parent directory of the indicated JAR entry.


min

static int min(int i1,
               int i2,
               int i3)

calcEntryLength

static int calcEntryLength(String name,
                           boolean pref)
Returns the number of characters needed to write a preferred list entry with the given name and preferred setting. If the given name is null, then the length of a "default" preferred list entry (i.e., an entry without a name) is returned.


writeEntry

static void writeEntry(Writer w,
                       String name,
                       boolean pref)
                throws IOException
Writes preferred list entry with the given name and preferred setting. If the given name is null, then a "default" preferred list entry is written.

Throws:
IOException


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.