本文整理汇总了Java中org.apache.harmony.archive.util.Util类的典型用法代码示例。如果您正苦于以下问题:Java Util类的具体用法?Java Util怎么用?Java Util使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Util类属于org.apache.harmony.archive.util包,在下文中一共展示了Util类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNextEntry
import org.apache.harmony.archive.util.Util; //导入依赖的package包/类
/**
* Returns the next ZipEntry contained in this stream or null if no more
* entries are present.
*
* @return java.util.zip.ZipEntry
* @exception java.io.IOException
* If an error occurs while reading the entry
*/
@Override
public ZipEntry getNextEntry() throws IOException {
if (mEntry != null) {
jarEntry = mEntry;
mEntry = null;
jarEntry.setAttributes(null);
} else {
jarEntry = (JarEntry) super.getNextEntry();
if (jarEntry == null) {
return null;
}
if (verifier != null) {
isMeta = Util.toASCIIUpperCase(jarEntry.getName()).startsWith(
JarFile.META_DIR);
if (isMeta) {
verStream = new ByteArrayOutputStream();
} else {
verStream = verifier.initEntry(jarEntry.getName());
}
}
}
eos = false;
return jarEntry;
}
示例2: equals
import org.apache.harmony.archive.util.Util; //导入依赖的package包/类
/**
* Returns whether the argument provided is the same as the attribute
* name.
*
* @return if the attribute names correspond.
* @param object
* An attribute name to be compared with this name.
*/
@Override
public boolean equals(Object object) {
if (object == null || object.getClass() != getClass()
|| object.hashCode() != hashCode()) {
return false;
}
return Util.asciiEqualsIgnoreCase(name, ((Name) object).name);
}
示例3: readMetaEntries
import org.apache.harmony.archive.util.Util; //导入依赖的package包/类
/**
* Called by the JarFile constructors, this method reads the contents of the
* file's META-INF/ directory and picks out the MANIFEST.MF file and
* verifier signature files if they exist. Any signature files found are
* registered with the verifier.
*
* @throws IOException
* if there is a problem reading the jar file entries.
*/
private void readMetaEntries() throws IOException {
// Get all meta directory entries
ZipEntry[] metaEntries = getMetaEntriesImpl();
if (metaEntries == null) {
verifier = null;
return;
}
boolean signed = false;
for (ZipEntry entry : metaEntries) {
String entryName = entry.getName();
// Is this the entry for META-INF/MANIFEST.MF ?
if (manifestEntry == null
&& Util.asciiEqualsIgnoreCase(MANIFEST_NAME, entryName)) {
manifestEntry = entry;
// If there is no verifier then we don't need to look any further.
if (verifier == null) {
break;
}
} else {
// Is this an entry that the verifier needs?
if (verifier != null
&& (Util.asciiEndsWithIgnoreCase(entryName, ".SF")
|| Util.asciiEndsWithIgnoreCase(entryName, ".DSA")
|| Util.asciiEndsWithIgnoreCase(entryName, ".RSA"))) {
signed = true;
InputStream is = super.getInputStream(entry);
byte[] buf = InputStreamHelper.readFullyAndClose(is);
verifier.addMetaEntry(entryName, buf);
}
}
}
// If there were no signature files, then no verifier work to do.
if (!signed) {
verifier = null;
}
}
示例4: readMetaEntries
import org.apache.harmony.archive.util.Util; //导入依赖的package包/类
/**
* Called by the JarFile constructors, this method reads the contents of the
* file's META-INF/ directory and picks out the MANIFEST.MF file and
* verifier signature files if they exist. Any signature files found are
* registered with the verifier.
*
* @throws IOException
* if there is a problem reading the jar file entries.
*/
private void readMetaEntries() throws IOException {
// Get all meta directory entries
ZipEntry[] metaEntries = getMetaEntriesImpl();
if (metaEntries == null) {
verifier = null;
return;
}
boolean signed = false;
for (ZipEntry entry : metaEntries) {
String entryName = entry.getName();
// Is this the entry for META-INF/MANIFEST.MF ?
if (manifestEntry == null
&& Util.asciiEqualsIgnoreCase(MANIFEST_NAME, entryName)) {
manifestEntry = entry;
// If there is no verifier then we don't need to look any further.
if (verifier == null) {
break;
}
} else {
// Is this an entry that the verifier needs?
if (verifier != null
&& (Util.asciiEndsWithIgnoreCase(entryName, ".SF")
|| Util.asciiEndsWithIgnoreCase(entryName, ".DSA")
|| Util.asciiEndsWithIgnoreCase(entryName, ".RSA"))) {
signed = true;
InputStream is = super.getInputStream(entry);
byte[] buf = InputStreamHelper.readFullyAndClose(is);
verifier.addMetaEntry(entryName, buf);
}
}
}
// If there were no signature files, then no verifier work to do.
if (!signed) {
verifier = null;
}
}
示例5: hashCode
import org.apache.harmony.archive.util.Util; //导入依赖的package包/类
@Override
public int hashCode() {
if (hashCode == 0) {
hashCode = Util.toASCIILowerCase("name").hashCode();
}
return hashCode;
}
示例6: JarInputStream
import org.apache.harmony.archive.util.Util; //导入依赖的package包/类
/**
* Constructs a new JarInputStream from stream
*/
public JarInputStream(InputStream stream, boolean verify)
throws IOException {
super(stream);
if (verify) {
verifier = new JarVerifier("JarInputStream"); //$NON-NLS-1$
}
if ((mEntry = getNextJarEntry()) == null) {
return;
}
String name = Util.toASCIIUpperCase(mEntry.getName());
if (name.equals(JarFile.META_DIR)) {
mEntry = null; // modifies behavior of getNextJarEntry()
closeEntry();
mEntry = getNextJarEntry();
name = mEntry.getName().toUpperCase();
}
if (name.equals(JarFile.MANIFEST_NAME)) {
mEntry = null;
manifest = new Manifest(this, verify);
closeEntry();
if (verify) {
verifier.setManifest(manifest);
if (manifest != null) {
verifier.mainAttributesChunk = manifest
.getMainAttributesChunk();
}
}
} else {
Attributes temp = new Attributes(3);
temp.map.put("hidden", null); //$NON-NLS-1$
mEntry.setAttributes(temp);
/*
* if not from the first entry, we will not get enough
* information,so no verify will be taken out.
*/
verifier = null;
}
}
示例7: readMetaEntries
import org.apache.harmony.archive.util.Util; //导入依赖的package包/类
private void readMetaEntries() throws IOException {
ZipEntry[] metaEntries = getMetaEntriesImpl(null);
int dirLength = META_DIR.length();
boolean signed = false;
if (null != metaEntries) {
for (ZipEntry entry : metaEntries) {
String entryName = entry.getName();
if (manifestEntry == null
&& manifest == null
&& Util.ASCIIIgnoreCaseRegionMatches(entryName,
dirLength, MANIFEST_NAME, dirLength,
MANIFEST_NAME.length() - dirLength)) {
manifestEntry = entry;
if (verifier == null) {
break;
}
} else if (verifier != null && entryName.length() > dirLength
&& (Util.ASCIIIgnoreCaseRegionMatches(entryName, entryName.length() - 3, ".SF", 0 ,3) //$NON-NLS-1$
|| Util.ASCIIIgnoreCaseRegionMatches(entryName, entryName.length() - 4, ".DSA", 0 ,4) //$NON-NLS-1$
|| Util.ASCIIIgnoreCaseRegionMatches(entryName, entryName.length() - 4, ".RSA", 0 ,4))){ //$NON-NLS-1$
signed = true;
InputStream is = super.getInputStream(entry);
byte[] buf = new byte[is.available()];
try {
is.read(buf, 0, buf.length);
} finally {
is.close();
}
verifier.addMetaEntry(entryName, buf);
}
}
}
if (!signed) {
verifier = null;
}
}
示例8: addMetaEntry
import org.apache.harmony.archive.util.Util; //导入依赖的package包/类
/**
* Add a new meta entry to the internal collection of data held on each jar
* entry in the <code>META-INF</code> directory including the manifest
* file itself. Files associated with the signing of a jar would also be
* added to this collection.
*
* @param name
* the name of the file located in the <code>META-INF</code>
* directory.
* @param buf
* the file bytes for the file called <code>name</code>.
* @see #removeMetaEntries()
*/
void addMetaEntry(String name, byte[] buf) {
metaEntries.put(Util.toASCIIUpperCase(name), buf);
}