当前位置: 首页>>代码示例>>Java>>正文


Java Util类代码示例

本文整理汇总了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;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:33,代码来源:JarInputStream.java

示例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);
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:18,代码来源:Attributes.java

示例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;
    }
}
 
开发者ID:keplersj,项目名称:In-the-Box-Fork,代码行数:49,代码来源:JarFile.java

示例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;
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:49,代码来源:JarFile.java

示例5: hashCode

import org.apache.harmony.archive.util.Util; //导入依赖的package包/类
@Override
public int hashCode() {
    if (hashCode == 0) {
        hashCode = Util.toASCIILowerCase("name").hashCode();
    }
    return hashCode;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:8,代码来源:Attributes.java

示例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;
    }
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:43,代码来源:JarInputStream.java

示例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;
    }
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:39,代码来源:JarFile.java

示例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);
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:17,代码来源:JarVerifier.java


注:本文中的org.apache.harmony.archive.util.Util类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。