private static class JarWrapper.PreferredListWriter extends Object
Modifier and Type | Class and Description |
---|---|
private class |
JarWrapper.PreferredListWriter.DirNode
Represents JAR-internal directory.
|
private static class |
JarWrapper.PreferredListWriter.FileNode
Stores file preference state.
|
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
JarWrapper.PreferredListWriter(List apiClasses)
Constructs a
PreferredListWriter . |
Modifier and Type | Method and Description |
---|---|
(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.
|
private static final int NAME_LEN
private static final int PREFERRED_LEN
private static final int TRUE_LEN
private static final int FALSE_LEN
private static final int NEWLINE_LEN
private final HashMap pathMap
private final JarWrapper.PreferredListWriter.DirNode rootNode
private int numPrefs
private final List apiClasses
JarWrapper.PreferredListWriter(List apiClasses)
PreferredListWriter
.apiClasses
- list of URI paths representing classes that must be
considered API classes in case a preferences conflict arrises during
wrapping of JAR filesvoid addEntries(JarFile jar, JarWrapper.PreferredListReader prefReader) throws IOException
IOException
void write(JarOutputStream jout) throws IOException
IOException
private void addFile(String path, String jarFileName, boolean preferred) throws IOException
IOException
private static String parentPath(String path)
static int min(int i1, int i2, int i3)
static int calcEntryLength(String name, boolean pref)
static void writeEntry(Writer w, String name, boolean pref) throws IOException
IOException
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.