- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我想为存储文件创建一个 zip 存档并将 ZipArchiveEntry.CompressionLevel
设置为 CompressionLevel.NoCompression
,但是当我在 Release模式下运行我的 android apk 时,所有 ZipArchiveEntries 都被压缩并且比率 >0%。
我使用 xamarin for android 4.1.1.3 并在 lenovo tab 4 A7-30GC 和 asus Z00VD 中测试 apk。
示例代码:
public void AddToArchive(string EntryName, string Path, DateTime TimeStamp)
{
ZipArchiveEntry zipEntry = this.Archive.CreateEntry(EntryName, CompressionLevel.NoCompression);
zipEntry.LastWriteTime = TimeStamp;
using (Stream entryStream = zipEntry.Open())
{
using (Stream fileStream = File.Open(Path, FileMode.Open, FileAccess.Read, FileShare.Read))
{
fileStream.CopyTo(entryStream);
fileStream.Close();
}
entryStream.Close();
}
}
谢谢。
最佳答案
基于 Microsoft .Net 引用源(通过 Mono 源),设置 CompressionLevel
仅为底层压缩代码提供“提示”。
您会看到某些文件在以“零”压缩级别压缩时最终会看到一些压缩,这是由于无论请求的压缩级别如何都进行了文件优化。这将在 Mono、Xamarin.Android、Xamarin.iOS、.Net 等中找到...
This is an abstract concept and NOT the ZLib compression level. There may or may not be any correspondance with the a possible implementation-specific level-parameter of the deflater.
///------------------------------------------------------------------------------
/// <copyright file="CompressionLevel.cs" company="Microsoft">
/// Copyright (c) Microsoft Corporation. All rights reserved.
/// </copyright>
///
/// <owner>gpaperin</owner>
///------------------------------------------------------------------------------
// This is an abstract concept and NOT the ZLib compression level.
// There may or may not be any correspondance with the a possible implementation-specific level-parameter of the deflater.
public enum CompressionLevel {
Optimal = 0,
Fastest = 1,
NoCompression = 2
}
关于c# - 将 ZipArchiveEntry.CompressionLevel 设置为 CompressionLevel.NoCompression 在 xamarin android 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38704792/
我使用的是 Gradle 插件的 0.6.1 版,当我告诉它不要压缩时,aaptOptions 似乎被忽略了。我们预压缩所有 PNG 以加快构建过程(在我们构建的服务器上需要大约 10 分钟/构建)所
一言以蔽之 我需要 Eclipse APK 自动构建功能来使用与 ant 命令行版本大致相同的build设置。 较长的版本 关于如何在不压缩的情况下将 Assets 或资源打包到 APK 中,已经进行
我想为存储文件创建一个 zip 存档并将 ZipArchiveEntry.CompressionLevel 设置为 CompressionLevel.NoCompression,但是当我在 Relea
我是一名优秀的程序员,十分优秀!