访问“媒体”; JDK 中 Blackberry 的目录

发布于 2024-07-19 09:04:20 字数 447 浏览 3 评论 0原文

尝试使用 JSR 75 访问保存在 '/home 下的媒体设备上的 /video/' 目录。 使用黑莓 JDK 4.6.1。 单行代码引发“文件系统 IO 错误”异常。 和往常一样,这毫无帮助。

fconn = (FileConnection)Connector.open("file:///home/user/videos/"+name, Connector.READ);

有人尝试这样做吗? 我可以打开 jar 中的文件,但似乎无法访问媒体文件夹。 我拥有 javax.microedition.io.Connector.file.read 权限集,并且我的应用程序已签名。

Trying to use JSR 75 to access media saved under the '/home/video/' directory on the device. Using Blackbery JDK 4.6.1. Single line of code throws a 'FileSystem IO Error' Exception. Which is, as usual, unhelpful in the extreme.

fconn = (FileConnection)Connector.open("file:///home/user/videos/"+name, Connector.READ);

Has anyone tried to do this? I can open files within my jar, but can't seem to access the media folder. I have the javax.microedition.io.Connector.file.read permission set and my appplication is signed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

攒一口袋星星 2024-07-26 09:04:20

BlackBerry 上有两种文件系统 - SDCard 和 store。 您必须使用其中之一,并在路径中定义它。 SDCard 上存储视频、音乐等的标准目录是“file:///SDCard/BlackBerry”。

    String standardPath = "file:///SDCard/BlackBerry";
    String videoDir = System.getProperty("fileconn.dir.videos.name");
    String fileName = "video.txt";
    String path = standardPath+"/"+videoDir+"/"+fileName;
    String content = "";
    FileConnection fconn =  null;
    DataInputStream is = null;
    ByteVector bytes = new ByteVector();
    try {
        fconn = (FileConnection) Connector.open(path, Connector.READ);
        is = fconn.openDataInputStream();

        int c = is.read();
        while(-1 != c)
        {
            bytes.addElement((byte) (c));
            c = is.read();
        }

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    content = new String(bytes.toArray());
    add(new RichTextField(content));

另请参阅
SUN Dev Network - FileConnection API 入门
RIM 论坛 - 有关 FileConnection/JSR 75 的一些问题
使用 System.getProperty("fileconn.dir.memorycard") 检查是否SD卡可用
如何保存和保存 在 Blackberry Storm 中删除位图图像?

There are two kind of filesystems on BlackBerry - SDCard and store. You have to use one of them, defining it in the path. Standard directory on SDCard where video, music etc stored is "file:///SDCard/BlackBerry".

    String standardPath = "file:///SDCard/BlackBerry";
    String videoDir = System.getProperty("fileconn.dir.videos.name");
    String fileName = "video.txt";
    String path = standardPath+"/"+videoDir+"/"+fileName;
    String content = "";
    FileConnection fconn =  null;
    DataInputStream is = null;
    ByteVector bytes = new ByteVector();
    try {
        fconn = (FileConnection) Connector.open(path, Connector.READ);
        is = fconn.openDataInputStream();

        int c = is.read();
        while(-1 != c)
        {
            bytes.addElement((byte) (c));
            c = is.read();
        }

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    content = new String(bytes.toArray());
    add(new RichTextField(content));

See also
SUN Dev Network - Getting Started with the FileConnection APIs
RIM Forum - Some questions about FileConnection/JSR 75
Use System.getProperty("fileconn.dir.memorycard") to check if SDCard available
How to save & delete a Bitmap image in Blackberry Storm?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文