Java Code Examples for proguard.classfile.ClassConstants#PACKAGE_SEPARATOR
The following examples show how to use
proguard.classfile.ClassConstants#PACKAGE_SEPARATOR .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JarWriter.java From atlas with Apache License 2.0 | 5 votes |
public boolean createDirectory(DataEntry dataEntry) throws IOException { // Make sure we can start with a new entry. if (!prepareEntry(dataEntry)) { return false; } // Close the previous ZIP entry, if any. closeEntry(); // Get the directory entry name. String name = dataEntry.getName() + ClassConstants.PACKAGE_SEPARATOR; // We have to check if the name is already used, because // ZipOutputStream doesn't handle this case properly (it throws // an exception which can be caught, but the ZipDataEntry is // remembered anyway). if (jarEntryNames.add(name)) { // Create a new directory entry. currentJarOutputStream.putNextEntry(new ZipEntry(name)); currentJarOutputStream.closeEntry(); } // Clear the finisher. currentFinisher = null; currentDataEntry = null; return true; }
Example 2
Source File: JarWriter.java From proguard with GNU General Public License v2.0 | 5 votes |
public boolean createDirectory(DataEntry dataEntry) throws IOException { // Make sure we can start with a new entry. if (!prepareEntry(dataEntry)) { return false; } // Close the previous ZIP entry, if any. closeEntry(); // Get the directory entry name. String name = dataEntry.getName() + ClassConstants.PACKAGE_SEPARATOR; // We have to check if the name is already used, because // ZipOutputStream doesn't handle this case properly (it throws // an exception which can be caught, but the ZipDataEntry is // remembered anyway). if (jarEntryNames.add(name)) { // Create a new directory entry. currentJarOutputStream.putNextEntry(new ZipEntry(name)); currentJarOutputStream.closeEntry(); } // Clear the finisher. currentFinisher = null; currentDataEntry = null; return true; }
Example 3
Source File: ZipDataEntry.java From proguard with GNU General Public License v2.0 | 5 votes |
public String getName() { // Get the right separators. String name = zipEntry.getName() .replace(File.separatorChar, ClassConstants.PACKAGE_SEPARATOR); // Chop the trailing directory slash, if any. int length = name.length(); return length > 0 && name.charAt(length-1) == ClassConstants.PACKAGE_SEPARATOR ? name.substring(0, length -1) : name; }
Example 4
Source File: DataEntryRenamer.java From proguard with GNU General Public License v2.0 | 5 votes |
public void read(DataEntry dataEntry) throws IOException { String name = dataEntry.getName(); // Add a directory separator if necessary. if (dataEntry.isDirectory() && name.length() > 0) { name += ClassConstants.PACKAGE_SEPARATOR; } String newName = (String)nameMap.get(name); if (newName != null) { // Remove the directory separator if necessary. if (dataEntry.isDirectory() && newName.length() > 0) { newName = newName.substring(0, newName.length() - 1); } renamedDataEntryReader.read(new RenamedDataEntry(dataEntry, newName)); } else if (missingDataEntryReader != null) { missingDataEntryReader.read(dataEntry); } }
Example 5
Source File: JarWriter.java From bazel with Apache License 2.0 | 5 votes |
public boolean createDirectory(DataEntry dataEntry) throws IOException { // Make sure we can start with a new entry. if (!prepareEntry(dataEntry)) { return false; } // Close the previous ZIP entry, if any. closeEntry(); // Get the directory entry name. String name = dataEntry.getName() + ClassConstants.PACKAGE_SEPARATOR; // We have to check if the name is already used, because // ZipOutputStream doesn't handle this case properly (it throws // an exception which can be caught, but the ZipDataEntry is // remembered anyway). if (jarEntryNames.add(name)) { // Create a new directory entry. currentJarOutputStream.putNextEntry(new ZipEntry(name)); currentJarOutputStream.closeEntry(); } // Clear the finisher. currentFinisher = null; currentDataEntry = null; return true; }
Example 6
Source File: ZipDataEntry.java From bazel with Apache License 2.0 | 5 votes |
public String getName() { // Get the right separators. String name = zipEntry.getName() .replace(File.separatorChar, ClassConstants.PACKAGE_SEPARATOR); // Chop the trailing directory slash, if any. int length = name.length(); return length > 0 && name.charAt(length-1) == ClassConstants.PACKAGE_SEPARATOR ? name.substring(0, length -1) : name; }
Example 7
Source File: DataEntryRenamer.java From bazel with Apache License 2.0 | 5 votes |
public void read(DataEntry dataEntry) throws IOException { String name = dataEntry.getName(); // Add a directory separator if necessary. if (dataEntry.isDirectory() && name.length() > 0) { name += ClassConstants.PACKAGE_SEPARATOR; } String newName = (String)nameMap.get(name); if (newName != null) { // Remove the directory separator if necessary. if (dataEntry.isDirectory() && newName.length() > 0) { newName = newName.substring(0, newName.length() - 1); } renamedDataEntryReader.read(new RenamedDataEntry(dataEntry, newName)); } else if (missingDataEntryReader != null) { missingDataEntryReader.read(dataEntry); } }
Example 8
Source File: ClassNameParser.java From proguard with GNU General Public License v2.0 | 4 votes |
public StringMatcher parse(String regularExpression) { int index; StringMatcher nextMatcher = new EmptyStringMatcher(); // Look for wildcards. for (index = 0; index < regularExpression.length(); index++) { // Is there an 'L///;' wildcard? if (regularExpression.regionMatches(index, "L///;", 0, 5)) { SettableMatcher settableMatcher = new SettableMatcher(); // Create a matcher, recursively, for the remainder of the // string, optionally preceded by any type. nextMatcher = new OrMatcher(parse(regularExpression.substring(index + 5)), createAnyTypeMatcher(settableMatcher)); settableMatcher.setMatcher(nextMatcher); break; } // Is there an 'L***;' wildcard? if (regularExpression.regionMatches(index, "L***;", 0, 5)) { // Create a matcher for the wildcard and, recursively, for the // remainder of the string. nextMatcher = createAnyTypeMatcher(parse(regularExpression.substring(index + 5))); break; } // Is there a '**' wildcard? if (regularExpression.regionMatches(index, "**", 0, 2)) { // Create a matcher for the wildcard and, recursively, for the // remainder of the string. nextMatcher = new VariableStringMatcher(null, new char[] { ClassConstants.TYPE_CLASS_END }, 0, Integer.MAX_VALUE, parse(regularExpression.substring(index + 2))); break; } // Is there a '*' wildcard? else if (regularExpression.charAt(index) == '*') { // Create a matcher for the wildcard and, recursively, for the // remainder of the string. nextMatcher = new VariableStringMatcher(null, new char[] { ClassConstants.TYPE_CLASS_END, ClassConstants.PACKAGE_SEPARATOR }, 0, Integer.MAX_VALUE, parse(regularExpression.substring(index + 1))); break; } // Is there a '?' wildcard? else if (regularExpression.charAt(index) == '?') { // Create a matcher for the wildcard and, recursively, for the // remainder of the string. nextMatcher = new VariableStringMatcher(null, new char[] { ClassConstants.TYPE_CLASS_END, ClassConstants.PACKAGE_SEPARATOR }, 1, 1, parse(regularExpression.substring(index + 1))); break; } // Is there a '%' wildcard? else if (regularExpression.charAt(index) == '%') { // Create a matcher for the wildcard and, recursively, for the // remainder of the string. nextMatcher = new VariableStringMatcher(INTERNAL_PRIMITIVE_TYPES, null, 1, 1, parse(regularExpression.substring(index + 1))); break; } } // Return a matcher for the fixed first part of the regular expression, // if any, and the remainder. return index != 0 ? (StringMatcher)new FixedStringMatcher(regularExpression.substring(0, index), nextMatcher) : (StringMatcher)nextMatcher; }
Example 9
Source File: ClassNameParser.java From bazel with Apache License 2.0 | 4 votes |
public StringMatcher parse(String regularExpression) { int index; StringMatcher nextMatcher = new EmptyStringMatcher(); // Look for wildcards. for (index = 0; index < regularExpression.length(); index++) { // Is there an 'L///;' wildcard? if (regularExpression.regionMatches(index, "L///;", 0, 5)) { SettableMatcher settableMatcher = new SettableMatcher(); // Create a matcher, recursively, for the remainder of the // string, optionally preceded by any type. nextMatcher = new OrMatcher(parse(regularExpression.substring(index + 5)), createAnyTypeMatcher(settableMatcher)); settableMatcher.setMatcher(nextMatcher); break; } // Is there an 'L***;' wildcard? if (regularExpression.regionMatches(index, "L***;", 0, 5)) { // Create a matcher for the wildcard and, recursively, for the // remainder of the string. nextMatcher = createAnyTypeMatcher(parse(regularExpression.substring(index + 5))); break; } // Is there a '**' wildcard? if (regularExpression.regionMatches(index, "**", 0, 2)) { // Create a matcher for the wildcard and, recursively, for the // remainder of the string. nextMatcher = new VariableStringMatcher(null, new char[] { ClassConstants.TYPE_CLASS_END }, 0, Integer.MAX_VALUE, parse(regularExpression.substring(index + 2))); break; } // Is there a '*' wildcard? else if (regularExpression.charAt(index) == '*') { // Create a matcher for the wildcard and, recursively, for the // remainder of the string. nextMatcher = new VariableStringMatcher(null, new char[] { ClassConstants.TYPE_CLASS_END, ClassConstants.PACKAGE_SEPARATOR }, 0, Integer.MAX_VALUE, parse(regularExpression.substring(index + 1))); break; } // Is there a '?' wildcard? else if (regularExpression.charAt(index) == '?') { // Create a matcher for the wildcard and, recursively, for the // remainder of the string. nextMatcher = new VariableStringMatcher(null, new char[] { ClassConstants.TYPE_CLASS_END, ClassConstants.PACKAGE_SEPARATOR }, 1, 1, parse(regularExpression.substring(index + 1))); break; } // Is there a '%' wildcard? else if (regularExpression.charAt(index) == '%') { // Create a matcher for the wildcard and, recursively, for the // remainder of the string. nextMatcher = new VariableStringMatcher(INTERNAL_PRIMITIVE_TYPES, null, 1, 1, parse(regularExpression.substring(index + 1))); break; } } // Return a matcher for the fixed first part of the regular expression, // if any, and the remainder. return index != 0 ? (StringMatcher)new FixedStringMatcher(regularExpression.substring(0, index), nextMatcher) : (StringMatcher)nextMatcher; }