本文整理汇总了Java中java.util.jar.JarOutputStream.setLevel方法的典型用法代码示例。如果您正苦于以下问题:Java JarOutputStream.setLevel方法的具体用法?Java JarOutputStream.setLevel怎么用?Java JarOutputStream.setLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.jar.JarOutputStream
的用法示例。
在下文中一共展示了JarOutputStream.setLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SignedJarBuilder
import java.util.jar.JarOutputStream; //导入方法依赖的package包/类
/**
* Creates a {@link SignedJarBuilder} with a given output stream, and signing information.
* <p/>If either <code>key</code> or <code>certificate</code> is <code>null</code> then
* the archive will not be signed.
* @param out the {@link OutputStream} where to write the Jar archive.
* @param key the {@link PrivateKey} used to sign the archive, or <code>null</code>.
* @param certificate the {@link X509Certificate} used to sign the archive, or
* <code>null</code>.
* @throws IOException
* @throws NoSuchAlgorithmException
*/
public SignedJarBuilder(OutputStream out, PrivateKey key, X509Certificate certificate)
throws IOException, NoSuchAlgorithmException {
mOutputJar = new JarOutputStream(new BufferedOutputStream(out));
mOutputJar.setLevel(9);
mKey = key;
mCertificate = certificate;
if (mKey != null && mCertificate != null) {
mManifest = new Manifest();
Attributes main = mManifest.getMainAttributes();
main.putValue("Manifest-Version", "1.0");
main.putValue("Created-By", "1.0 (Android)");
mBase64Encoder = new BASE64Encoder();
mMessageDigest = MessageDigest.getInstance(DIGEST_ALGORITHM);
}
}
示例2: LocalSignedJarBuilder
import java.util.jar.JarOutputStream; //导入方法依赖的package包/类
/**
* Creates a {@link SignedJarBuilder} with a given output stream, and signing information.
* <p/>If either <code>key</code> or <code>certificate</code> is <code>null</code> then
* the archive will not be signed.
*
* @param out the {@link OutputStream} where to write the Jar archive.
* @param key the {@link PrivateKey} used to sign the archive, or <code>null</code>.
* @param certificate the {@link X509Certificate} used to sign the archive, or
* <code>null</code>.
* @throws IOException
* @throws NoSuchAlgorithmException
*/
public LocalSignedJarBuilder(@NonNull OutputStream out,
@Nullable PrivateKey key,
@Nullable X509Certificate certificate,
@Nullable String builtBy,
@Nullable String createdBy,
@Nullable String signFile) throws IOException, NoSuchAlgorithmException {
mOutputJar = new JarOutputStream(new BufferedOutputStream(out));
mOutputJar.setLevel(9);
mKey = key;
mCertificate = certificate;
mSignFile = signFile;
if (mKey != null && mCertificate != null) {
mManifest = new Manifest();
Attributes main = mManifest.getMainAttributes();
main.putValue("Manifest-Version", "1.0");
if (builtBy != null) {
main.putValue("Built-By", builtBy);
}
if (createdBy != null) {
main.putValue("Created-By", createdBy);
}
mMessageDigest = MessageDigest.getInstance(DIGEST_ALGORITHM);
}
}