javax.microedition.io.file.FileConnection JavaDoc?

I'm looking for the JavaDoc on the next class: javax.microedition.io.file.FileConnection

I searched the JavaDoc for the GCF at the link below.  There is no results for FileConnection, or javax.microedition.io.file else.

Generic connection framework, Version 8 (b75)

Based on this link for the docs to Blackberry, the javax.microedition.io.file.FileConnection used to be generated with the JavaDocs (there are maybe, but always seems the JavaDoc has a bug)

FileConnection (BlackBerry JDE API Reference 7.1.0)

If you know where the CURRENT package and class are documented, I would be grateful for the tip!

Brent S

Hi Brent,

In fact, that javadoc FileConnection on the blackberry site should be current. This is because is JSR 75 FileConnection and JSR 75 had only one version, 1.00. This JSR is not owned by Oracle so you see it's javadoc on the Oracle website. However in regards to any JSR you can download it here https://jcp.org/en/jsr/detail?id=75

One more comment: GCF as he is of his name is a framework. It outlines the principles of the Organization of generic access to the connections so that provides some specific protocols. But this is not the end: it is designed, the other parts of the Java stack would be connect by providing specific features of protocols. And actually, there are these parts there. For example JSR75 FileConnection or Bluetooth JSR82

Kind regards

Andrey

Tags: Java

Similar Questions

  • Exception of security with javax.microedition.io.file import. *;

    Okay, so I don't know if I have a problem because I sign my application or what.   This code works fine in the Simulator, but does not work on the phone, so I'm a bit puzzled.

    Basically, I am trying to create a directory that a user can browse through and ultimately define a destination for saving a file.

    This is the code in question, which works fine on the emulator but gives permission denied errors (security exception) on the phone itself.

    Any ideas would be delicious.

    Convector of vector = new Vector();
    currentPath = currentPath.concat ((String) fileList.get (list of files, fileList.getSelectedIndex ()));
    try {}
    FileConnection conn = (FileConnection) Connector.open (currentPath);
    If (conn.isDirectory ())
    {
    Enumeration dirEnum = conn.list ();
    conVector.removeAllElements ();
    While (dirEnum.hasMoreElements ())
    {
    String n = (String) dirEnum.nextElement ();
    If (toAdd.endsWith("/")) conVector.addElement (toAdd);
    }
    String [] dirContents = new String [conVector.size ()];
    conVector.copyInto (dirContents);
    fileList.set (dirContents);
    }

    } catch (System.Exception e)
    {
    System.out.println (try ());
    errorDia ed = new errorDia();
    Dg = ed.createLoginError dialog box (try ());
    dlParent.pushError (dg);
    }

    }

    Weird...

    Apparently I've been putting the wrong initial path.  The strange thing is, it worked fine in the emualtor, but not at all on the device itself.

  • Play sounds of media on a certain event? "Error: javax.microedition.media.MediaException: no support type.

    Hello, I'm trying to play MP3 files.
    Example, if the answer is just play then "sound1.mp3 '...
    However, I get this error: "" javax.microedition.media.MediaException: unsupported type of «»
    Although I read that mp3 files are supported.
    I used this tutorial " http://docs.blackberry.com/en/developers/deliverables/17968/CS_Playing_audio_in_a_BB_device_app_1222... ".

    Note: I use Blackberry JDE 5.

    This is the code that I have actually used (has not changed anything core):

    Try
    {

    Player p = javax.microedition.media.Manager.createPlayer ("C:/Documents and Settings/User/space work/celebrity/res/sounds/RoundStart");
    p.Realize ();
    VolumeControl volume = (VolumeControl) p.getControl ("VolumeControl");
    volume.setLevel (30);
    p.prefetch ();
    p.Start ();

    }
    catch(MediaException me)
    {
    Dialog.Alert(me.) ToString());
    System.out.println ("Error:" + me.toString ());
    }
    catch (IOException ioe)
    {
    Dialog.Alert (ioe. ToString());
    System.out.println ("Error:" + ioe.toString ());
    }

    ------------------

    Thanks for the help in advance

    If you want to reference audio files in your application, the above will not work.  You must code differently.

    try something like this

    Class cl = Class.forName(replace_this_with_your: packageName.classname); //
    InputStream is = cl.getResourceAsStream("/somesound.mp3");
                   
    Create an instance of the reader of the InputStream
    p = Manager.createPlayer (that is, "audio/mp3");

  • javax.microedition.Media.Control - where is it?

    So still trying to stream - and this time watching the video.  This HAS to be a simple explanation.

    I'm trying to create a VideoControl object - but get an error 'undefined class' VideoControl.

    I have:

    Javax.microedition.media import. *; in my file, then in frustration, I added:

    Import javax.microedition.media.control;

    How I got an error saying "cannot find class symbol control" on this line.

    I'm missing a few packets of MIDP 2.0 or something?

    I am using JDE 4.5 - but have tried ad 4.3 4.7 with the same result.

    Where are these stored in the JDE packages?

    Jim

    Good problem solved. Please mark the thread as solved.

  • Blackberry problems with javax.microedition.HttpConnection

    Hi all

    I am currently working on an application that connects to the Web service using javax.microedition.io.HttpConnection;

    I want to do several generations for the request of 4.7, 5.0 and 6.0. I have a very big problem because as I've debugged since now the request to the server is only to send the version 4.7 and I have not found a solution to work for other versions. The code is the same, but I have an InterruptedIOException with the message that LocalConnection expired after ~ 10000. I had this error on the 9800 Simulator tests.

    How it is possible to work on 4.7 but on other versions of crash?

    Have you had similar problems? Shoud I code to help with this? This is a very critical situation.

    Kind regards

    Bogdan

    Try to use '; deviceside = true' to your URL. Also, take a look at Peter in sticky for many useful code to develop applications of HttpConnection.

  • AllDAY using javax.microedition.pim.Event events calendar

    Hi all

    I try to save an event all day in the database using javax.microedition.pim.Event of PIM data. According to the Docs, I add an event that has a start time of 00:00:00:000 (defined by DateTimeUtilities.zeroCalendarTime) and a set of end for the next time, once again, the 00:00:00:000 value.

    The event shows correctly in the application calendar of BB, but it is not recognized as an Allday event.

    It is: that I need TO use the BlackBerryEvent interface to get the calendar to acknowledge an event like allday or I can do this with just using the event interface?

    Another issue: State of the Docs for the event interface:

    ------------------------------

    RIM implementation notes

    The value stored in the field of the END can be modified slightly when it is committed. The field is stored with a granularity of one minute compared to the STARTING field.

    ------------------------------

    Alteration is transparent to the user of the API? When I check the END field after you have selected and hired, it shows no alteration.

    Kind regards

    Carsten

    PS: Need to add that I use 4.5 JDE and the 8820 4.5 Simulator

    You must use BlackBerryEvent to specify a appointent all day.

    DerCarstenUK wrote:

    Hi all

    Another issue: State of the Docs for the event interface:

    ------------------------------

    RIM implementation notes

    The value stored in the field of the END can be modified slightly when it is committed. The field is stored with a granularity of one minute compared to the STARTING field.

    ------------------------------

    Alteration is transparent to the user of the API? When I check the END field after you have selected and hired, it shows no alteration.

  • new javax.microedition.lcdui.Graphics () error (not public are accessible)

    Hey. Just do some drawing and had a compilation error

    Graphics is not public in javax.microedition.lcdui.Graphics; are not accessible from the outer packaging

    javax.microedition.lcdui.Graphics gr = new javax.microedition.lcdui.Graphics ();   //

    gr.drawRect (100,50,200,100);

    In the online JDE 4.7 QAnywhere, the class is public not private. There's no docs for the Builder. I have tried providing an arg but no dice. I use this class of lcdui because other graphics can't shoot a picture object.

    Ideas appreciated, has soon

    J

    Hey-learned that the only way to get an instance of the javax.microedition.lcdui.Graphics object is to use

    myGraphics = javax.microedition.lcdui.Image.getGraphics)

    So that's it.

    JD

  • Consume a Web service using javax.microedition.xml.rpc.Operation

    Requirement. Consume a Web Service using native libraries of Blackberry.

    Target WebService: http://ws.cdyne.com/WeatherWS/Weather.asmx

    WebService of the operation: http://ws.cdyne.com/WeatherWS/Weather.asmx?op=GetCityWeatherByZIP

    Environment: Eclipse JDE 1.3.0 with BB SDK Enterprise Server BB 5.0.0

    First Guide of: http://blog.bayestech.com/?tag=blackberry

    1 Java Stub

    public interface IWeatherServiceZip
    {
        public String getWeatherServiceByZip(String zipCode) throws java.rmi.RemoteException;
    
    }
    

    2. Service Java class

    import java.rmi.RemoteException;
    import javax.microedition.xml.rpc.ComplexType;
    import javax.microedition.xml.rpc.Element;
    import javax.microedition.xml.rpc.Operation;
    import javax.microedition.xml.rpc.Type;
    import javax.xml.namespace.QName;
    import javax.xml.rpc.JAXRPCException;
    
    import com.lm.bb.ws.interfaces.IWeatherServiceZip;
    
    /**
     * @author lmo0
     *
     */
    public class WeatherServiceZip implements IWeatherServiceZip, javax.xml.rpc.Stub
    {
        protected static final QName _qname_operation_GetCityWeatherByZIP = new QName("http://ws.cdyne.com/WeatherWS", "GetCityWeatherByZIP");
        protected static final QName _qname_GetCityWeatherByZIPResponse = new QName("http://ws.cdyne.com/WeatherWS", "GetCityWeatherByZIPResponse");
        protected static final QName _qname_GetCityWeatherByZIP = new QName("http://ws.cdyne.com/WeatherWS", "GetCityWeatherByZIP");
        protected static final Element _type_GetCityWeatherByZIP;
        protected static final Element _type_GetCityWeatherByZIPResponse;
    
        private String[] _propertyNames;
        private Object[] _propertyValues;
    
        public WeatherServiceZip()
        {
            _propertyNames = new String[]
            { ENDPOINT_ADDRESS_PROPERTY };
            _propertyValues = new Object[]
            { "http://ws.cdyne.com/WeatherWS/Weather.asmx" };
        }
    
        public void _setProperty(String name, Object value)
        {
            int size = _propertyNames.length;
            for (int i = 0; i < size; ++i)
            {
                if (_propertyNames[i].equals(name))
                {
                    _propertyValues[i] = value;
                    return;
                }
            }
            String[] newPropNames = new String[size + 1];
            System.arraycopy(_propertyNames, 0, newPropNames, 0, size);
            _propertyNames = newPropNames;
            Object[] newPropValues = new Object[size + 1];
            System.arraycopy(_propertyValues, 0, newPropValues, 0, size);
            _propertyValues = newPropValues;
    
            _propertyNames[size] = name;
            _propertyValues[size] = value;
        }
    
        public Object _getProperty(String name)
        {
            for (int i = 0; i < _propertyNames.length; ++i)
            {
                if (_propertyNames[i].equals(name))
                {
                    return _propertyValues[i];
                }
            }
            if (ENDPOINT_ADDRESS_PROPERTY.equals(name)
                    || USERNAME_PROPERTY.equals(name)
                    || PASSWORD_PROPERTY.equals(name))
            {
                return null;
            }
            if (SESSION_MAINTAIN_PROPERTY.equals(name))
            {
                return new Boolean(false);
            }
            throw new JAXRPCException("Stub does not recognize property: " + name);
        }
    
        protected void _prepOperation(Operation op)
        {
            for (int i = 0; i < _propertyNames.length; ++i)
            {
                op.setProperty(_propertyNames[i], _propertyValues[i].toString());
            }
        }
    
        public String getWeatherServiceByZip(String zipCode) throws RemoteException
        {
            Object inputObject[] = new Object[]
            { zipCode };
    
            Operation op = Operation.newInstance(_qname_operation_GetCityWeatherByZIP,    _type_GetCityWeatherByZIP, _type_GetCityWeatherByZIPResponse);
            _prepOperation(op);
            op.setProperty(Operation.SOAPACTION_URI_PROPERTY,"http://ws.cdyne.com/WeatherWS/GetCityWeatherByZIP");//SOAP Action
            Object resultObj;
            try
            {
            resultObj = op.invoke(inputObject);
            System.out.print(resultObj.toString());
            } catch (JAXRPCException e)
            {
            e.printStackTrace();
            Throwable cause = e.getLinkedCause();
            if (cause instanceof java.rmi.RemoteException)
            {
            throw (java.rmi.RemoteException) cause;
            }
            throw e;
            }
            return (String) ((Object[]) resultObj)[0];
        }
    
        static
        {
            _type_GetCityWeatherByZIPResponse = new Element(_qname_GetCityWeatherByZIPResponse,_complexType(new Element[]
                    { new Element(new QName("http://ws.cdyne.com/WeatherWS","GetCityWeatherByZIPResult"), Type.STRING, 0, 1, false) }), 1, 1,false);
            _type_GetCityWeatherByZIP = new Element(_qname_GetCityWeatherByZIP,_complexType(new Element[]
                    { new Element(new QName("http://ws.cdyne.com/WeatherWS","ZIP"), Type.STRING, 0, 1, false) }), 1, 1, false);
            }
    
        private static ComplexType _complexType(Element[] elements)
        {
            ComplexType result = new ComplexType();
            result.elements = elements;
            return result;
        }
    }
    

    3 problem

    There is no information about the exception that occurs when I try to debug my Application actually when you call the Web Service to:

    resultObj = op.invoke (inputObject);

    Any help.  If you have any other suggestions on how to consume a web service using BB. I don't want to use KSOAP2 because the source code is not updated more and prefer the native BB mode without using the 3rd party jars.

    Thank you

    How do you generate the stub class? Have you used Sun's Wireless Toolkit?

  • How to set up a Multicast UDP connection? I get the following error: javax.microedition.io.ConnectionNotFoundException

    I need build a Multicas UDP connection, with the following connection string: multicast://224.2.3.4:8888,.
    udpMulticastConnection = (UDPMulticastConnection) Connector.open (" " "multicast://224.2.3.4:8888");

    but I'm javax.microedition.io.ConnectionNotFoundException.

    I read in the doc of the api, I have made a UDPDatagramConnection. I wore the UDPDatagramConnection but the udpMulticast still not do.

    Can someone help me? Please

    Thank you.

    Some useful links:

    https://docs.Oracle.com/JavaME/8.0/API/GCF/API/javax/microedition/IO/package-summary.html

    UDPDatagramConnection (Java (TM) ME generic connection Framework, Version 8 (final JSR360))

    BNF multicast protocol

    Java (TM) ME generic connection Framework, Version 8 (final version of JSR360)

    http://docs.Oracle.com/JavaME/8.0/API/GCF/API/javax/microedition/IO/ConnectionNotFoundException.html

    https://docs.Oracle.com/JavaME/8.0/API/GCF/API/javax/microedition/IO/package-summary.html

    Hello!

    Unfortunately, multicast is not supported by Java ME on RPi. Looks like it still takes much effort to patch raspbian OS itself to support so that we did not continue to support me. Sorry

    Kind regards

    Andrey

  • ADF Mobile Client: Error when trying to import javax.microedition. *.

    Hello

    JDev throws errors at compile time when I try to deploy a sample Client Mobile ADF application.
    These errors are related to the import of javax.microedition.io. *.

    Error (11,29): javax.microedition.io package does not exist
    Error (12,29): javax.microedition.io package does not exist
    Error (180,9): could not find class HttpConnection
    Error (191,27): cannot find class HttpConnection
    Error (191,42): cannot find variable connector
    Error (250,49): inconvertible types
    Error (303,40): cannot find variable HttpConnection

    Guidance on the way in which these errors could be solved?

    Is there a wireless JDev extension to be installed to fix these errors related to J2ME?

    For JDev 10 g, I could find such an extension called JWE here: http://www.oracle.com/technology/products/iaswe/archive/developer/index.html
    I couldn't find any similar extension for JDeveloper 11.1.3.

    Kind regards
    Prasad.

    Hi, I just want to assure you - have you installed the ADF MObile Client extension yet? Visit JDev-Help-Check for updates official Oracle Extensions and updates and find the Extension of Oracle ADF MObile Client in the list. Check it out, download it and then restart JDev. It seems that the extension is not installed, is not able to load J2ME libraries.

    If you downloaded the extension already, please go to properties-libraries and classpath of the project and then see if the sample application makes reference to third party libraries, for example something RIM. If so, please check the path to the library.

    Once you have installed the extension, you can also access the customer Mobile ADF Developer's guide - it contains all the documentation around what you need to install first. Please take a look and see what you install - at the very least, you need to install BlackBerry JDE if you want to deploy for BlackBerry and Windows Mobile Emulator, if you want to test the application on Windows Mobile. Finally, if you need to synchronize the data, then you must also install Oracle Database Server Lite for MObile.

    Thank you

    Joe Huang

  • Class ' javax.mircoedition.io.file. FileConnection ' not found. "

    Hi guys.

    I am facing problem with this exception.

    Device name: 7130e

    OS version: Iam not sure to which is. Exactly, that's 4.2 or 4.1.

    My application using FileConnection.

    I need to upgrade the version of the OS?

    In fact, I want to work my request on 7130e with no problems.

    Thanks in advance.

    Hello

    FileConnection is supported since OS Version 4.2.

    Kind regards

    Jochen

  • writing from the end of the file - FileConnection or PrintOutPutStream

    Hi all
    Im a new developer of blackberry and I were assigned to make a newspaper for the app I'm working on. The newspaper is supposed to be written to a file, but whenever the application is run, the new content is not meant to replace the old.
    The thing is that I have not found an outputStream or a method that allows me to move the cursor to the end of the file, so I can start writing something new without crushing the old.
    So two questions in one:
    If I said:
    fileCon = (FileConnection) Connector.open (_filePath, Connector.WRITE);
    Fact writing status measures me which the OutPutStream I get from fileCon.openDataOutputStream (); will have his slider at the end of the file?

    If this is not the case, can you please tell me if there is a way to do this?
    Thanks in advance
    Claudio Veas

    To add to a file, open the outputStream with a parameter that specifies the length of the file. This will put the cursor at the end of the file.

    Somethng lik this:

    FC = (FileConnection) Connector.open (fn);
    If (! fc.exists ())
    FC. Create();
    int size = (int) fc.fileSize ();
    OutputStream os = null;
    If (size > 0)
    OS = fc.openOutputStream (fileSize);
    on the other
    OS = fc.openOutputStream ();
    Return (OS);

    Rab

  • javax.microedition.media.MediaException: unsupported type of record coding

    I try to capture the audio using the MMAPI:

    Manager.createPlayer ("capture://audio?encoding=pcm")

    Also tried: Manager.createPlayer ("capture://audio?encoding=audio/basic")

    The above work on a "BOLD" (4.6) device, but on the storm (4.7) he throws as the MediaException in the GPO. I tried on the 9500 Simulator and the real device.

    PCM encoding is no longer supported?

    The BlackBerry Storm does not support PCM encoding.  Quote from the article below: "Note: the PCM format is not supported by the BlackBerry smartphones that operate on the Code Division Multiple Access (CDMA) network.»

    How - Audio recording on a BlackBerry smartphone
    Article number: DB-00562

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1089414/How_To...

  • Application crashes with the Exception when using javax.microedition.media.Player

    Hello

    I have an application that processes data from bluetooth and send it to the web service. Recently, there was a request to add sounds to the request. Now when the application processes lots of data and the player plays constantly after a few seconds I get exception "Application is not responding. And then the treatment is finished. In the newspapers, I see many connected after this exception ForcedStackTrace exception.

    The sounds are played in the separate thread. If the app is not play sounds or short sounds - everything works fine. Is it possible to avoid what happens an exception? Why this is happening?

    Thanks in advance,

    Viktor.

    Solved by implementing my own PlayerManager, which running in a separate thread would point the way to the queue rather then the number of threads by using the internal player application.

  • How to recover the art Image since an .mp3 file ID3

    Hi all

    Is it possible to recover images art ID3 of an audio file. I used successfully MetaDataControl API to retrieve other properties of file but I can't find the art inside picture specification.

    OK, I was interested in how do you extract the image of myself, I gave you just a generalization of what to do. I wrote a 'fast' service and dirty. Fuction has many types of treaties even if not used and I have not tested on several types of images and MP3s so use at your own risk. It is not optimized and don't go back not the 'mime type' when the runction is returned because I finished creating a new string rather than edit an existing one.

    Anyway, that this should work:

    public static net.rim.device.api.system.EncodedImage getID3Image(java.io.InputStream fs, long fsPos, long fsLength, String mimeType)
            throws java.io.UnsupportedEncodingException, java.io.IOException
    {
        /*---------------------------
         * ID3 v1 tags cannot contain images, so no need to process them.
         * ID3 v1 tags are also placed at the end of the MP3 so checking the beginning of the file won't do anything useful.
         *---------------------------
         */
    
        //Read the tags, searching for the album artwork
        byte[] imageData = null;
        boolean foundImage = false;
        mimeType = null;
        while (!foundImage)
        {
            byte[] buffer = new byte[10];
            fs.mark(10);
            if ((fs.read(buffer, 0, 10) != 10) || !(new String(buffer, 0, 3, "UTF-8").equals("ID3")))
            {
                fs.reset();
                break;
            }
            fsPos += 10;
            //Found a ID3 version 2 or greater tag
    
            //Now to actually parse a tag
            int majorVersion = buffer[3] & 0xFF;
            byte minorVersion = buffer[4];
            byte[] destinationArray = new byte[4];
            System.arraycopy(buffer, 6, destinationArray, 0, 4);
            //Read a 28bit int for size
            int size = (((((destinationArray[0] & 0xFF) << 0x15) | ((destinationArray[1] & 0xFF) << 14)) | ((destinationArray[2] & 0xFF) << 7)) | (destinationArray[3] & 0xFF));
            long end = fsPos + size;
            fs.mark((int)size);
            long dataLength = end - 11L;
    
            boolean ver2 = true;
    
            if (majorVersion == 2)
            {
                //ID3 v2.2
                ver2 = true;
            }
            else if (majorVersion == 3 || majorVersion == 4)
            {
                //ID3 v2.3/ID3 v2.4
    
                //Extra data seems might exist, go through
                boolean hasExtendedHeader = (buffer[5] & 0x40) == 0x40;
                if (hasExtendedHeader)
                {
                    byte[] exHeadBuf = new byte[4];
                    fs.read(exHeadBuf, 0, 4);
                    fsPos += 4;
                    int exHeadLength = (((((exHeadBuf[0] & 0xFF) << 0x18) | ((exHeadBuf[1] & 0xFF) << 0x10)) | ((exHeadBuf[2] & 0xFF) << 8)) | (exHeadBuf[3] & 0xFF));
                    byte[] exHeadData = new byte[exHeadLength + 4];
                    System.arraycopy(exHeadBuf, 0, exHeadData, 4, exHeadLength);
                    fs.read(exHeadData, 4, exHeadLength);
                    fsPos += exHeadLength;
                    //No use for this data in the pic so just ignore it
                }
                ver2 = false;
            }
    
            for (boolean flag = true; (fsPos < dataLength) && flag; )
            {
                //Get the frame header and make sure that it is a valid frame.
                byte[] fBuf = new byte[ver2 ? 6 : 10];
                if ((fs.read(fBuf, 0, fBuf.length) != fBuf.length) || ((fBuf[0] & 0xFF) <= 0))
                {
                    flag = false;
                    continue;
                }
                fsPos += fBuf.length;
                String frameId = new String(fBuf, 0, ver2 ? 3 : 4, "UTF-8");
                destinationArray = new byte[ver2 ? 3 : 4];
                System.arraycopy(fBuf, destinationArray.length, destinationArray, 0, destinationArray.length);
                int frameCount = 0;
                switch (majorVersion)
                {
                    case 2:
                        //24bit
                        frameCount = ((((destinationArray[0] & 0xFF) << 0x10) | ((destinationArray[1] & 0xFF) << 8)) | (destinationArray[2] & 0xFF));
                        break;
                    case 3:
                        //32bit
                        frameCount = (((((destinationArray[0] & 0xFF) << 0x18) | ((destinationArray[1] & 0xFF) << 0x10)) | ((destinationArray[2] & 0xFF) << 8)) | (destinationArray[3] & 0xFF));
                        break;
                    case 4:
                        //28bit
                        frameCount = (((((destinationArray[0] & 0xFF) << 0x15) | ((destinationArray[1] & 0xFF) << 14)) | ((destinationArray[2] & 0xFF) << 7)) | (destinationArray[3] & 0xFF));
                        break;
                    default:
                        continue;
                }
                //Now read the data and check to see if it is a picture
                fBuf = new byte[frameCount];
                if (fs.read(fBuf, 0, frameCount) == frameCount)
                {
                    fsPos += frameCount;
                    if (frameId.equals("PIC") || frameId.equals("APIC"))
                    {
                        //Got the frame data
                        int refPoint = 0;
                        //First we get the encoding type
                        int encType = (fBuf[refPoint++] & 0xFF); //0=ISO8859, 1=Unicode,2=UnicodeBE,3=UTF8
                        //Second we get the mime type
                        int indexPoint = refPoint;
                        while (fBuf[refPoint++] != 0)
                        {
                        }
                        int mimeLength = refPoint - indexPoint;
                        if (mimeLength > 1)
                        {
                            mimeType = new String(fBuf, indexPoint, mimeLength - 1, "ISO-8859-1");
                        }
                        //Third we get the picture type
                        int picType = (fBuf[refPoint++] & 0xFF);
                        //Fourth we load the picture description
                        byte[] desBuf;
                        switch (encType)
                        {
                            case 0:
                            case 3:
                                //8bit string
                                byte num;
                                net.rim.device.api.util.ByteVector list = new net.rim.device.api.util.ByteVector();
                                while ((refPoint < fBuf.length) && ((num = fBuf[refPoint++]) != 0))
                                {
                                    list.addElement(num);
                                }
                                desBuf = list.toArray();
                                break;
                            case 1:
                            case 2:
                                //16bit string
                                list = new net.rim.device.api.util.ByteVector();
                                do
                                {
                                    byte item = fBuf[refPoint++];
                                    byte num2 = fBuf[refPoint++];
                                    if ((item == 0) && (num2 == 0))
                                    {
                                        break;
                                    }
                                    if (((item != 0xff) || (num2 != 0xfe)) || (encType != 1))
                                    {
                                        list.addElement(item);
                                        list.addElement(num2);
                                    }
                                }
                                while (refPoint < (fBuf.length - 1));
                                desBuf = list.toArray();
                                break;
                            default:
                                throw new java.io.UnsupportedEncodingException("Cannot get picture description. Frame Encoding is invalid.");
                        }
                        String description;
                        switch (encType)
                        {
                            case 0:
                                description = new String(desBuf, "ISO-8859-1");
                                break;
                            case 1:
                                description = new String(desBuf, "UTF-16");
                                break;
                            case 2:
                                description = new String(desBuf, "UTF-16BE");
                                break;
                            case 3:
                                description = new String(desBuf, "UTF-8");
                                break;
                        }
                        //Finally, THE MAIN EVENT, the image data
                        int imCount = fBuf.length - refPoint;
                        imageData = new byte[imCount];
                        System.arraycopy(fBuf, refPoint, imageData, 0, imCount);
                        foundImage = true;
                        break;
                    }
                }
                continue;
            }
            fs.reset();
            continue;
        }
        if (imageData != null)
        {
            //We found the image
            if(mimeType != null && mimeType.length() > 0)
            {
                //Save some time in searching for image type
                return net.rim.device.api.system.EncodedImage.createEncodedImage(imageData, 0, imageData.length, mimeType);
            }
            else
            {
                return net.rim.device.api.system.EncodedImage.createEncodedImage(imageData, 0, imageData.length);
            }
        }
        //No image found
        mimeType = null;
        return null;
    }
    

    The sample code I used was:

    try
    {
        javax.microedition.io.file.FileConnection file = (javax.microedition.io.file.FileConnection)javax.microedition.io.Connector.open(path, javax.microedition.io.Connector.READ);
        if(file.exists())
        {
            java.io.InputStream fs = file.openInputStream();
            long pos = 0L;
            long length = file.fileSize();
            String mime = "";
            net.rim.device.api.system.EncodedImage image = getID3Image(fs, pos, length, mime);
            fs.close();
        }
        file.close();
    }
    catch(Exception e)
    {
    }
    

    Just the value of 'path' and an image will be returned.

    Edit: Added an if statement that changed value Boolean ver2. Also the length and the position probably don't matter, but it was just for safety, but I says that it can decode the description with UTF-16, the javadoc for 4.7.0 (the version I made and tested with) said that he supports of UTF-16 (Big Endian), but does not specify if Big Endian UTF-16 (not) is supported. Finally, a few points of optimization could be:

    • remove the descriptions (don't know not 100% if they determine if it is album art, the logo of the Publisher, etc.)
    • remove the image type (variable picType)
    • remove the minor version
    • change (if you decide to keep) "get byte" code description image so just realize that the bytes and let Java take care to get the bytes (as what the code for the type MIME)
    • replaceing the MIME parameter with a StringBuffer type so that you can get the MIME type when the function returns.
    • remove the "if(majorVersion == 2)" block because ver2 is set to true already and does not need to be redefined.

    Edit 2: Fixed a quick Oops, also found this which sets the value type (variable picType) image:

    • X 00 other
    • x 01 32 x 32 pixels 'file icon' (PNG only)
    • x 02 other file icon
    • X 03 cover (front)
    • x 04 (back) cover
    • x 05 page of the brochure
    • x 06 Media (e.g. lable side of the CD)
    • x 07 lead artist/lead performer/soloist
    • x 08 artist/performer
    • x 09 conductor
    • X0A Band/Orchestra
    • x0B composer
    • lyricist/text writer x0C
    • Saving x0D location
    • X0E during recording
    • x0F during execution
    • x 10 screenshot of film/video
    • X 11 has light colored fish
    • X 12 illustration
    • X 13 logo group/artist
    • x 14 logo editor/Studio

    From: http://www.id3.org/id3v2.3.0

Maybe you are looking for