Access the Blackberry Media Directory in JDK

Attempted to use JSR 75 to access media stored in the directory '/ home / video /' on the device. Using Blackbery JDK 4.6.1. One line of code throws an exception. ' FileSystem IO Error' Which, as usual, is useless in a pinch.

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

Has anyone tried to do this? I can open files in my bank, but I can’t access the media folder. I have permission set javax.microedition.io.Connector.file.readand my application is signed.

+3
source share
1 answer

BlackBerry - SDCard . , . 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 - API- FileConnection
RIM - FileConnection/JSR 75
System.getProperty( "fileconn.dir.memorycard" ), , SDCard
Blackberry Storm?

+5

Source: https://habr.com/ru/post/1707715/


All Articles