- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个包含文件夹的 zip 文件,在文件夹中我有一些图像文件。我希望提取这些图像。但是我找不到任何东西。我一直在查看 zipMe,但一直无法找到查找任何相关帮助。
下面是我到目前为止开发的代码。
ZipEntry dataZE;
InputStream isData;
StringBuffer sbData;
ZipInputStream dataZIS;
String src = "file:///store/home/user/images.zip";
String path = "file:///store/home/";
String fileName = "";
FileConnection f_Conn;
public UnZipper() {
debugger("Unzipper constructor");
try {
f_Conn = (FileConnection) Connector.open(src);
} catch (IOException e) {
debugger("f_conn error :" + e.getMessage());
}
try {
isData = f_Conn.openInputStream();
} catch (IOException e) {
debugger("f_conn error getting ip_stream:" + e.getMessage());
}
sbData = new StringBuffer();
dataZIS = new ZipInputStream(isData);
debugger("got all thing initialized");
}
public void run() {
debugger("unzipper run");
try {
startUnziping();
} catch (IOException e) {
debugger("Error unzipping " + e.getMessage());
}
debugger("finished...");
}
private void startUnziping() throws IOException {
debugger("startUnziping");
dataZE = dataZIS.getNextEntry();
fileName = dataZE.getName();
writeFile();
dataZIS.closeEntry();
debugger(">>>>>>>>>>> : " + fileName);
}
private void readFile() throws IOException {
debugger("readFile");
int ch;
int i = 0;
while ((ch = dataZIS.read()) != -1) {
debugger((i++) + " : " + sbData.toString()
+ " >>> writting this..");
sbData.append(ch);
}
}
private void writeFile() {
debugger("writting file...");
FileConnection f_Conn = null;
byte[] file_bytes = new byte[sbData.length()];
file_bytes = sbData.toString().getBytes();
try {
readFile();
} catch (IOException e) {
debugger("Error while reading " + e.getMessage());
}
try {
f_Conn = (FileConnection) Connector.open(path + fileName);
} catch (IOException e) {
debugger("getting f_conn" + e.getMessage());
}
if (!f_Conn.exists()) {
// create the file first
debugger("I know file does not exists");
try {
f_Conn.mkdir();
} catch (IOException e) {
debugger("Oops!!! error creating fle : " + e.getMessage());
}
}
try {
f_Conn.setWritable(true);
debugger("file is nt writeable");
} catch (IOException e) {
debugger("cannot make it writeable : " + e.getMessage());
}
OutputStream lo_OS = null;
try {
lo_OS = f_Conn.openOutputStream();
debugger("got out Stream hero!!!");
} catch (IOException e) {
debugger("cant get out Stream !!!");
}
try {
lo_OS.write(file_bytes);
debugger("yess...writtent everything");
} catch (IOException e) {
add(new LabelField("Error writing file ..." + e.getMessage()));
}
try {
lo_OS.close();
debugger("now closing connection...");
} catch (IOException e) {
debugger("error closing out stream : " + e.getMessage());
}
}
}
我已经能够获得代表包含图像的文件夹的 ZipEntry,但是我无法弄清楚我必须如何提取这些图像。
感谢您的帮助。
最佳答案
在 startUnzipping
中遍历 zip 文件中的所有 ZipEntry
(您只处理代码中的第一个)。子文件对应的项目名称应为“文件夹名/文件名”。
关于blackberry - 在黑莓中解压缩/提取 Zip 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11290051/
我想创建后台应用程序,它将监听哪些应用程序已启动以及哪些应用程序移至前台。 请回复 如果问题不清楚会再次解释。 谢谢 最佳答案 这是你可以做的: 使用 ApplicationManager.getFo
下午好。 我开始用 java 和 blackberry 编程。 我正在开发一个带有三个窗口的应用程序,我将显示有关设备的基本信息,这些窗口已经完成并可以工作。 我需要创建一个在后台运行的进程,这个进程
如何翻转 Bitmap上下翻转? (我需要这个来在另一个程序中加载 OpenGL 纹理)。 这是我失败的尝试: stripe.png(由 Pitr@OpenClipart 提供): 翻转.java:
从 Internet 上可用于签署 BB 应用程序的内容来看,我可以猜测我们只需要用于签署应用程序的 .cod 文件,而不需要源代码。 有人可以确认这一点吗? 最佳答案 编译代码时会自动生成 .cod
我想访问闹钟。在我的应用程序中,我已成功访问日历并设置了约会,但我如何访问闹钟。请帮我。以下是我的代码 public class Alarm { private Event event;
作为应用程序的一部分,我们将在设备上的“file:///store/home/user/”位置创建一个文件 myApp.cfg。设备上的加密已启用。因此,myApp.cfg 被重命名为 myApp.c
我需要制作一个包含可点击号码的标签,这样当用户点击标签时,就会调用电话号码(或向用户显示调用电话的选项)。当我现在点击标签时,我只得到一个工具提示类型的菜单,其中包含复制数字的选项... privat
我有兴趣在我的 BlackBerry 应用程序中添加一个可拖动的 slider 。 我想知道 BlackBerry API 中是否有类似的东西,或者是否有人做过类似的东西! 最佳答案 有一个Gauge
最初开发黑莓应用的时候,并没有太在意能够支持多种屏幕分辨率。所以,我最终得到了在 320*240 分辨率下运行良好但在其他屏幕上完全困惑的代码。 我该如何解决这个问题?或者一般来说,如果不为每个资源构
我创建了一个这样的静态函数。 public static Bitmap Bitmap(String path) { Bitmap bitmap = Bitmap .ge
我需要 BlackBerry 本地化方面的帮助。我在 http://na.blackberry.com/eng/developers/resources/developer_labs.jsp#tab_
我创建了一个 RichTextField 我想让它只允许整数值。我怎样才能做到这一点? 最佳答案 你可以尝试这样的事情: public class MyRichTextField extends Ri
在 BlackBerry 平台中,我想知道是否可以/如何执行以下操作: 检索通话记录(我对来电记录特别感兴趣); 删除特定的通话记录; 最佳答案 要检索电话日志,请查看 PhoneCallLog cl
我想知道我们是否可以调整图像大小。假设我们要在黑莓屏幕上绘制一个实际尺寸为200x200且尺寸为100 x 100的图像。 谢谢 最佳答案 只是一种选择: BlackBerry - draw imag
黑莓 JDE 不包括 java.util.ArrayList ,即使它知道 java.util ?那是怎么回事? BB 有对应的类(class)吗?我不想使用数组,真的,因为我要处理的对象数量未知。为
我想使用 graphics.drawLine 方法在 drawListRow 中的黑莓 Listfield 中添加一个分隔符,但下面根本没有绘制线是我正在使用的来源 drawListRow(ListF
我正在为Blackberry设备开发一个应用程序。这个程序包含一个数据库。由于该API是在最新的API版本上提供的,因此我决定使用SQLite。 我遵循了随处都可以找到的所有示例,但是无论发生什么情况
我已将 Blackberry 4.6.0 应用程序移植到 4.7.0 上的 Storm。除了我试图控制的触摸事件之外,一切都运行良好。我在下面的方法中捕获触摸事件,它按预期执行,但问题是在我的 tou
我正在为 BB 开发一个项目。该应用程序与网络一起工作,并通过 HTTP 发送/接收数据。现在我使用队列和队列管理器。管理器从一个后台线程开始,并在 while (true) 循环中工作,检查队列中是
我想在黑莓中合并两个图像。一张图像是大图像,另一张图像是小图像。小图像的位置将由开发人员定义。有哪些可能的方法? 最佳答案 您可以使用 Graphics 类以不同的偏移量在其上绘制多个位图。查看Gra
我是一名优秀的程序员,十分优秀!