Array of bytes in JSON string is not a valid JSONObject.

I get an array of bytes from a URL that I can view in Google Chrome as a valid JSON object.

When I get the answer to IOUtilities.streamToBytes (), it returns in the following way:

[16, 8, 1, 10, 2,... 1, 0, 0, 8, 0, 0, 120, 2, 0]

How can I convert the byte array to a human readable string I can spend in the JSONObject constructor?

I tried the following character encodings:

  • "ISO-8859-1".
  • 'UTF-8 '.
  • "UTF-16BE".
  • "US-ASCII".

Hello

First, check with your http connection that it returns the appropriate response.

           connection=(HttpConnection)Connector.open(url,Connector.READ);
            connection.setRequestMethod(HttpConnection.GET);
            if(connection.getResponseCode()==HttpConnection.HTTP_OK)
            {
                inputstream=connection.openInputStream();
                int ch;
                buffer=new StringBuffer();
                while((ch=inputstream.read())!=-1)
                {
                    buffer.append((char)ch);
                }
                System.out.println(buffer.toString());
            }

If so, you need to spend just that data in json for parsing.i

Thankx

Tags: BlackBerry Developers

Similar Questions

  • String is not a valid XSD: November 1, 10

    Hello

    I have the following situation:

    Tag XML: < CP_START_DATE > 1 November 10 < / CP_START_DATE >

    need to convert the tag above in Etext_ XML report to appear as the following format: 1011 (YYMM)

    I tried to_char, to_date, but it did not work... Could you please help me who?


    Thank you
    Ramez

    Make sure that the column is retrieved as a date, otherwise ensure its form canonical.
    Check that model eText not convert EBS Date DD-MON-YYYY' at 'DDMMYY' (Doc ID 1182744.1)

  • Array of bytes and KSOAP2

    Hello
    I have a request. I have a MSSQL database into two columns. One is a varchar and the second is the Image type. I would use these two fields filled to KSOAP2. I tried to send a picture in KSOAP byte array but it did not, probably, I sometimes confuse.
    Here is the source code.

    public byte[] getBytesFromBitmap(Bitmap bmp) {
     try {
      int height=bmp.getHeight();
      int width=bmp.getWidth();
      int[] rgbdata = new int[width*height];
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      DataOutputStream dos = new DataOutputStream(bos);
      bmp.getARGB(rgbdata,0,width,0,0,width,height);
      for (int i = 0; i < rgbdata.length ; i++) {
       if (rgbdata[i] != -1) {
        dos.writeInt(i);
        dos.flush();
        //l++;
       }
      }
      bos.flush();
      return bos.toByteArray();
     } catch (Exception ex) {
      Dialog.alert("getBytesFromBitmap: " + ex.toString()); return null;
     }
    }
    
    Bitmap borderBitmap = Bitmap.getBitmapResource("rounded.png");
    byte[] img = getBytesFromBitmap(borderBitmap);
    String name = "Name";
    SoapObject rpc = new SoapObject(serviceNamespace, "name");
    
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    rpc.addProperty("_img", img);
    rpc.addProperty("_string", name);
    envelope.setOutputSoapObject(rpc);
    envelope.bodyOut = rpc;
    envelope.dotNet = true;
    envelope.encodingStyle = SoapSerializationEnvelope.XSD;
    

    I also tried... I transferred the image in the array of bytes to a string, using the string, I sent KSOAP and everything went well... The problem was that if she string converted to array of bytes, and then in a Bitmap, then bb do not show Bitmap. I would like to send a byte array.

    Thank you

    Stepan

    This function is useful to get the bytes of the image.

    public static byte[] returnByte(String path)
    {
    FileConnection fconn;
    int available = 0;
    InputStream input = null;
    byte[] data=null;
    try
    {
    fconn = (FileConnection)Connector.open(path);
    if(fconn.exists()==true)
    {
    input = fconn.openInputStream();
    available = input.available();
    int fSz = (int)fconn.fileSize();
    data = new byte[fSz];
    input.read(data, 0, fSz);
    }
    }
    catch(Exception e)
    {
    Dialog.alert("Error");
    }
    return data;
    }
    

    Now you must do this:

    Byte [] img = returnByte ("pawan.png");

    rpc.addProperty("_img", Base64.encode(img));
    

    I'm sure it works...

    Thank you

  • What is the best way to convert an array of bytes or string cluster

    I am writing a program that sends UDP packets and I defined the data I want to send via large groups (with numbers of u8, u16/u32, u16/u8/u32 tables and nested groups). Just before sending the data, I need to convert groups or chains of arrays of bytes. The flatten the string function is almost perfect for this. However, it is addition of lengths in the tables and strings that makes this unusable method, because as far as I can tell.

    As I have many of these groups, I would rather not hard code the unbundle names and conversion/cast of strings or arrays of bytes for each of them.

    Y at - it a function, or a tool that I'm on?

    Thank you!

    mkirzon wrote:

    The program I'm developing is to communicate and to poll an external device that includes a Protocol well documented. The messages that I built in clusters contain components accurate that expected from the other device. So, if my program adds any additional info (such as this array/string lengths), monitor the device external won't recognize messages and returns an error.

    Unfortunately, you have to ungroup your cluster and collect the individual channels to concatinate.

  • Pass an array of bytes to the oracle stored procedure

    I have a problem with moving from byte array in Oracle stored procedure as an input parameter by using odp.net.

    Here is the signature of the stored procedure:

    SOMEPROCEDURE(session IN NUMBER, data IN RAW)

    Here is c# code, which calls the procedure:

    var cmd = new OracleCommand("SOME_PROCEDURE", _connection);

    cmd.CommandType = CommandType.StoredProcedure;

    var bt = new byte[]{1,68,0,83,128,1};

    OracleParameter sessionId = new OracleParameter("dbSessionId", OracleDbType.Decimal, new OracleDecimal(_dbSessionId), ParameterDirection.Input);

    OracleParameter data = new OracleParameter("statusData", OracleDbType.Raw, new OracleBinary(bt), ParameterDirection.Input);

    cmd.Parameters.Add(sessionId);

    cmd.Parameters.Add(data);

    cmd.ExecuteNonQuery();

    This code does not (stored procedure throws exception, which cannot receive), because in byte array hadou number 128!, if I display 128 on another number, minus 128, it works great!

    What should I do?

    After some tests I found the solution. Initially, you cannot switch to the array of bytes via the odp.net stored procedure, if the table contains 127 large values.

    Yes, solution: 1. create the wrapper procedure

    procedure SOME_PROCEDURE_WRAPPER (p_session_id in number, p_data  in varchar2)
     is v_data raw(1024);
     rawdata raw(1024); 
     rawlen number;
     hex varchar2(32760);
     i number;
     begin
      rawlen := length(p_data);
      i := 1;
      while i <= rawlen-1
      loop 
     hex := substrb(p_data,i,2); 
         rawdata := rawdata || HEXTORAW(hex); 
         i := i + 2; end loop; 
         SOME_PROCEDURE(p_session_id , rawdata); 
     end;
    

    2 then need to modify the code c# in this way:

     var cmd = new OracleCommand("SOME_PROCEDURE_WRAPPER", _connection);
     cmd.CommandType = CommandType.StoredProcedure;
     string @string = statusData.ToHexString();
     OracleParameter sessionId = new OracleParameter("dbSessionId", OracleDbType.Decimal, new OracleDecimal(_dbSessionId), ParameterDirection.Input);
     OracleParameter data = new OracleParameter("statusData", OracleDbType.Varchar2,@string.Length, new OracleString(@string), ParameterDirection.Input);
     cmd.Parameters.Add(sessionId);
     cmd.Parameters.Add(data);
     cmd.ExecuteNonQuery();
    

    where

    public static string ToHexString(this byte[] bytes)
     { 
         if(bytes == null || bytes.Length == null)
               return string.Empty;
          StringBuilder hexStringBuilder = new StringBuilder();
          foreach (byte @byte in bytes)
          { 
              hexStringBuilder.Append(@byte.ToString("X2")); 
          } 
          return hexStringBuilder.ToString();
     }
    
  • How to convert an array of bytes in a single integer

    Hello!

    So, for the moment, I am trying to receive data from a device that sends data back as an array of 10 bytes, where the first 2 bytes are a header, 6 are a number of words that is supposed to be a unique 48-bit value and the last 2 are a number of errors which is suppose to be a unique 16-bit value.

    Ex:

    Word has received

    (Header)   (----------------------------------Word Count------------------------------)   (Number of errors)
    0            120     0               44              221          155          96             48             0              0

    So, in theory, what I want to do is be able to calculate the values like this:

    (Header)   (----------------------------------Word Count------------------------------)   (Number of errors)
    0            120     0               44              221          155          96             48             0              0
    The binary values: 00000000 00101100 11011101 10011011 01100000 00110000 00000000 00000000
    Concat. Vals: 000000000010110011011101100110110110000000110000 0000000000000000
    Calc'd Vals: = 192696508464 words = 0 errors
    * 40 (40-bit words)
    Totals: = 7.7078603e + 12 bits total = 0 Total errors

    But the problem that I am running is that all methods that I use seem to not be correct.

    I tried:

    Flatten the data and then it unflattening like a U64

    Convering to bool, concatinating tables data, and then convert that to a certain number

    Join all the bytes together using the join function

    Casting to an array of bytes to a U64

    And with all methods, the data that I use is incorrect (in the sense where the values are incorrect compared to this calculation manually like I did above), and at this point, I'm not sure how to get the correct values, so any kind of help would be greatly appreciated!

    Thank you!

    It seems to work for me...

  • Problem of cast to array of bytes in array of float

    Can someone help me find this process I am doing wrong?

    • I read a string of 6 tanks during the series.
    • I take the string and convert it to an array of bytes.
    • I then reverse the byte array because my microcontroller first sends the LSB and Labview is Big-endian
    • I catalogued this table in an array of float
    • I invert the table again to retrieve the data in the original order

    I can see the bytes in the array of bytes as 'byte, 0, 0, 0' when there are a small number, but when I I cataloged get very large or very small floats. Can someone help me understand this?

    Thank you!

    LabVIEW 2011

    You should probably use string unflatten, select the byte with rule of the little order and use a DBL 1 d array type. Everything must fall in place without all these gynastics bit, what you're doing.

    You can show us your code? I don't understand your use of "decimate the table."

    Attach a small VI containingh a typical chain received as a constant of diagram.

  • Large array of bytes sent via socket?

    Hello

    I have had this problem for a while and have never really stood under how to solve it properly. I don't understand how you are supposed to transfer arrays of bytes that are larger than the size of the buffer of the socket. I have semi overcome them chapter by chapter from the table and write through the sleeve and reassemble frequently on the other side, but this causes problems. What is the right way to send a byte array that is larger than the buffer socket on an outputstream?

    I suspect that I am thick here, but I'm not aware that there is something called a socket buffer.  Actually, let me rephrase.  I'm not aware that there is a specific size that was a little to the amount of data to a socket can accept.

    And you should, in theory, be able to send constantly bytes on a socket and the IP protocol should ensure that they arrive in the right order, at the other end, providing the connection is maintained.

    In practice there are limits, but I wasn't aware of a buffer size of socket specific related to the shots of Blackberry (or any Sockets besides /).

    The original poster might explain what determines the size of this buffer?

  • array of byte size limit]

    I download & save multimedia files (video/pdf) using following code. The question is his works well for small size files MB (1 MB to 18 mb), but for some 60 MB files it stuck during the download. or sometimes download does not start. Thr is a size limit for byte array coz I am booting with the length of the file. This len contains the bytes to be read

    int

    Len = (int) hc.getLength ();

    byte data = newbyte[len];

    if (len > 0) {

    intactual = 0;

    intBytesRead = 0;

    while ((bytesread! = len) & (real! = - 1)) {

    real =

    tell. Read (data, bytesread, len - bytesread);

    bytesRead += real;

    percentage = bytesread * 100;

    percentage = percentage / len;

    int p = percentage (int);

    ProgressIndicatorScreen.

    this.model.setValue (p);

    }

    }

    I don't think that there is a size limit for an array of bytes, this is probably a problem with the connection. Download large files has been difficult for ever.

  • BlackBerry how to parse date in a Json string...

    I have the server time in Json String.is there no Json deserializer for what there so I have time.
    If not pls suggest how I can analyze.

    "StartTime": "\/Date (1349818680000 + 0530) '--------/ '"

    Consider the time manually.

  • Image data that is embedded within a JSON string.

    Hi all!

    I would put the image data 'sequenced' in a JSON string so that I can use in ScriptUI, pick from a JSON object.

    An example is the following:

    'image' : ' \u0089PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00F\x00\x00\x00\x1E\b\x02\x00\x00\x00\x1E\ u0091\u00FFI\x00\x00\x00\x19tEXtSoftware\x00Adobe ImageReadyq\u00C9e < \x00\x00\x03\u0099IDATx\u00DA\u00EC\u0098\u00CDK\x14a\x1C\u00C7\u009DZ \u00EC\u00D0\u00AE\x07\x13\u00D4\u00C4\u00C2\u0097\u00D8,\u00D8\x12\u0094\u00A0\b\u00A2 \n\x02o\u00DD. [[: t\u00EC\u00D6\u00BDK\u00E7\u00AE] \x14,\u0083PR\u00935S \u00FA\x03\u00BAu\bO\u0082\u0081\u0087\u00 C4!] h\u00D7C\u00B3\u0097 > \u00E3\u00D7~ > \u00CC\u00AC\u00B3\u00B9\u00BB\ u00A2\u00C8 > \f\x0F\u00CF < \u00FB{\x7F\u009F\u00F5\u00DE\u008F\u00CE4\x1C\u00AFu\u00A2\u00E1 \u00D8\u00AD\u00BAJu\u0095\u008E\u008AJk\u00EB?\u00E7\x17\u00E6\u008E\u009B\u0097\n[\u00F9 Z1\u00C0@\u009Ff\u00A6\u00D8c'\x00\u00D8/\u00D9\x18\u0094DT\u0082o\x0B\u00B3\u0086\u00B6\u 00BA\u00B6\u00D2\u00DE\u00D6\u00A1\u00D7\u00E4\u00E9T [\u00EB\u00D9\u00F9\u00C5\x1D\x07^\u0 0CD\f\ u0084\u00A8\u00F7v\u00A7\u0093\u00C9\u0094\u00CE\u00F8Yv\u0081Z\x7Ff\u0090\u00BDP\u0 0C8\u009B\u00A5\f\u00D7\u00E5\b\u00FD\u00DE\u009E\u00B4K\u00D0n\u00C0\x15_ndq\u00A1\u00B8\ x1Cm\u009D|\u00FC\u00E8\u0089\u00FB\x0E\u00C4\u00F9\u00CE\u00AE\\n\x03\u00E9y.\u00F4\\\x1C \u00FF0v\u00E7\u00D6=\u00CE~\u00D1\u00FF85q\u00F3\u00FAm\u00CE\u0090\u00CE./57\u00B7Hm]~\u 009D\u00FD\u00C2.:\ u00D9\x1FK\u00C8\u00CD\u00EB\u0099\u00E6\x16\u00DF\u00F7\u00A13 = 3\x19\u 00C25\u008E\u00C5\u00A2\x0F\u00B0n \b\u00C0\u00A5\u00BE\u008C8\"=\x00P\x165n6s\x1B\u009C\u0085\u00D2\u00D8x\u00AA\u0092\u00F 2\u00804:@q\u00D7c\u00C9\u0094L\x0E{\u00D9\u00C9u/+_\u00F8m\u0096f\u00C7.\u00E8\x13\u00C2-\u00B9 \"\u00CF\u0088\u00A3\"\u00D6\u00A8\u00C9\"\u00F1\x02'\u00AAL\x15\u00E4Km5aZ\u00B9T\u0097 (@\u00A8\u00B0\u00A7\u0092M\n\u00B3\u00D5\u00F5\x15\u008BX\u00D3\u00B3D\x0E\x17\u00F2\u00FC) ' u00E4\u00E6\u0089\u00DC\u00AE'\x11\u0080\u0099f\x07 > \x12x\u0089\u00EA\u00B3\u00DF\x12C^\ ' \u008B\u00D0\u0084\u00FCq\u0099q\u00E3\u00E6\u00CF^\u00C9\u008D\u00DA\x04B\bR\u00BE2M\\\u0 087\x03\u00EF\x02\u00C7\x05\x1E\u00E9af0\u00A7\u00EFu6\u00DD\x14$ \x04\x15? \u00C1\x18i\u00E C! \u008FM\u008Dh\u0087\u00B0\x00\u0093\x03\u00ED\f\x11yi\u00FA\u00F3\u00A4\u00F1mo\u00ED\u 0088\u00B7\u00B2\x17\x1A[\u00AD\u00B6\u00B8\u009C\u00940%\u00CF\u00C4\u00BDdU\u0094\u0083\ u008B\u00F4!\u00E3\u0089\u00A6\u00EE\x05iUd\u00D7?\u00DB\x15RXf\x1D+hv\x13\u00AA\u0081%Iy\ x071\u0089\u008F\u008C\x0E\u00DF\u00BF; d\u00AF\x18; \x14\u0087\x07\u00BA\u00CA\u00AB$\x0B\u 0099y*h\u0085%\u00BB\u00C7\u00A1\u00CDxA\x7F (, \x04\u00F1\u00F0\u00F2\u00D5\u008B}\u00D1\x05 \u00C5\u009E\u00FF\u00D7\u00E7\u00D9\u00F3\u00A7e\u00ED[\u0095\u0097\u00E4\x1Fl\x1C\u00EC= \u00E9P\u00F8\u00CAu\u00AA\x07\u00FC\x14\u00F5\u00A1\u00CA@\u0090c\u00FFT2\u0082\u0096\u00 8D\ u00C18\u00B20\u00C7\u00AB\u00E5\u00AD\x11\u00D7Y\u009DW\u00DCU\u00E2\u00CA\u00C6K\u009C \u0097\u00A0H]\u0096\x1A\u00F0\u00A0\u00FD+}\u00DF\u00BC}\u00BD#\u00CD\u00E2\u00DC\u00C8\u 00BBa\u00E3\x1D\n <) /'%\u0098\u00BC\u00A7\u00B1\x18\u00C9T\x15\u00A5CP\ x1E\u00B6 [\u0099) {\u0 0CF\x19\\\u00F4\x07\u0080\u00B3\u00AC\u0080 < \u00D1zPf \n-\u009B;\u0090\u00FE\u00DA\u00C0\r\u009B\u00984\u00FB\u00F0l\u00E6~]\u00EE\u00CB\u00F0\ n3\x0E\u00AE\u0087\u00CFuv\u0081\u00E8y\u009E\\\u00C1\ u00AF\x1Ay\u0098\u00AA\u00FC\u00E2\x 1F\u00BA' \u00C4\u00E51$ \u00E6\u00A6\u00FF\u00CA 7\u0092\u0098 = \u00BB\u00FC} \u00E8\u00C1C (\u00F0\u00C0\x11\u00E5\u0099\u0092\x00\u0080l\u0 0ED\u00A7\u0087P\x0F\u0095\x04\b\x17\u00AD {\u00F4M\u0089\] u00A8Q\u00CD, \u00B3\u00B4.\u00B9 \u0089\u00C6\u0092\r_\u0087\u00F3\t\u00E8 & \u008C\u00A2\x0E\u00DFR\u00C7\u00D9\u00E9\u0092\ u00A1\u009C\u008EJ\u00BF\u00AFZZ\u00B2YW\u00AB\x12\ "\u0096\rhe3\u008B\u00E1\u0085\u00B3;\x 1F (\u00CB\u00CBr\u00B1\t & \u00CA1\u00FEs.\x11o\f2\u0084\u00E9 & \b\u008C\u00EE\u00B4\u008D\u0 0A1\u0096\u00E5\u00FC\u00BAW\u00CBr\u0085VQq? \x04\u0083I\u00C2! n\x15\u00C2\u00BD! \u00F0\u0 0A2\x1FN\u00F6\u00F5QU\u00AB = \u00AC\u00A5\u00E8\u00AD\x001qd\u00F5\x19\u009F\x18\u00ABl\u0 0F2\u00F0\u00EA\u00FF\u00B6\u00D6U\u00AA\u00ABT\u0093\u00F5W\u0080\x01\x00H@\u00A4W\u009F\ u008F\u00E9\u009D\x00\x00\x00\x00IEND\u00AEB'\u0082 " "

    As you can see, this site did not like all the stuff that are highlighted in red

    https://jsonformatter.curiousconcept.com/

    Parsing JSON was not working in the analysis of these data, and of course this image did not show in my ScriptUI dialog box.

    Any suggestions on how to format it to conform to the JSON syntax, if possible?

    Thanks Micky, it seemed that avoidance by means you listed had somehow changed some real characters, so it does not end up practicing in real code. However, I also noticed that the site I listed myself was less than optimal for understanding my problem: I used instead (http://codebeautify.org/jsonvalidate), I would have quickly noticed the blackslashes issue because it uses better syntax highlighting!

    Now, I decided to use encodeURI() to transform this channel of image data in a valid JSON string. It seems to work when you turn such a string directly in a ScriptUI.newImage (), but now I have to find one couple of other things to make sure he got by JSON analysis inside my script, I'm working on that.

  • Convert string (JSON string) JSON object?

    * EDIT *.

    I finally understand how to use #include instead of file.read (); This solves my immediate problem. However, I am always curious to know if it is possible to do what I request below, just in case there is a situation where for some reason any I can not just use #include. Thank you all. =)

    * EDIT *.

    * EDIT 2 *.

    Someone knows how to use #include for a file whose name is determined during execution of the script?

    For example... the orderNumber variable is generated by a window (lets say that the result is 1234567). the file I want to include will be called "1234567.js).

    What I want to do, it is something like:

    #include ' ~/Desktop/Info folder / "orderNumber + '.js '.

    (then I want to assign a variable the result somehow, since it is simply an anonymous object at this stage and I don't know how to access its content);

    * EDIT 2 *.

    Hey all. I have a (probably stupid) question about how to take a string that contains the JSON text and simply modify this type of 'chain' to 'object '... I'm wording probably this very badly.

    I get a file .js on my local network and by assigning a variable the result of file.read ();

    The content of the file is an anonymous object in JSON. However, when I use the file.read (); the object is placed in the string, like this:

    "{"Alignment": [{'name': 'Fink', 'number': '19', 'jerseySize': 'XL', 'quantity': '1',"topId": '78531'}, {thi s is the next player}, {it is the next player}]}"

    It's a massively simplified version of what I read actually, but you get the point. I want to put this object in the script that I'm running and create new objects based on the relevant information (in this case I need only the values for 'name', 'number' and 'jerseySize').

    So my question is this. How can I activate the above JSON string into:

    alignment of var =]

    {

    "name':"Fink. "

    «number»: "19.»

    {"jerseySize": "XL"},

    {

    next player

    },

    {

    next player

    }

    ]

    ???? A google search reveals the JSON.parse (text) method. But that is not supported in ESTK.

    for simple objects, as in the example, you could use eval() hurt, get rid of the 'alignment' first

    var str = "[{'name': 'Fink', 'number': '19', 'jerseySize': 'XL', 'quantity': '1',"topId": '78531'}, {'name': 'Fink', 'number': '19', 'jerseySize': 'XL', 'quantity': '1',"topId": '78531'}] '"

    alignment of var = eval (str);

    $.writeln(roster[0].number);

  • Adding a JSON string to a RESTful outgoing call in OSB 11.1.1.6

    Inside of my stream of messages of the Service Proxy (OSB 11.1.1.6), I have generated a JSON string and stored in a variable named $jsonReq.

    In my action of routing, I point to a Business Service that the Service Type is 'Messaging Service' with both Types of request/response as "Text" messages

    What is the right way to attribute the $jsonReq content of the variable for the body of the outgoing request (I'm making a POST)?

    I tried a number of configurations, but not prevail (although I see the content JSON when I throw out in a Log action), such as:

    Insert
    Expression: $jsonReq
    Location: as the first child of the
    XPath:.
    In Variable: coming out


    Please notify.

    Thank you
    Michael

    Use replace. / * in the variable body with $jsonReq choose replace entire node.

  • Sending the command apdu with an array of bytes as CDATA

    Hello
    I learn the java card as part of my final year project. So far I think I can do the most basic things, but I stuck a special moment.

    I know that there are different manufacturers to create an apdu command object and a number of these manufacturers take an array of bytes as CDATA values.

    My problem is, how do I access this data table in the side of the card because apdu.getBuffer () returns an array of integers (bytes)? And what is actually on apdu.getBuffer () [ISO7816. (Instead of OFFSET_CDATA)] when you send the apdu command object using such constuctor?

    concerning

    Published by: 992194 on 6 March 2013 06:12

    992194 wrote:
    (..) I should have mentioned earlier that my card use jc 2.2.1 version, and from different places, I've read that this version does not support ExtendedLength facilities.

    Indeed.

    I also understand the semantics of apdu.getBuffer () [ISO7816. OFFSET_CDATA] is the first byte of the data command. My question is, these command data was initially provided as an array of bytes. Something like this:

    + new CommandAPDU(CLA, INS, P1, P2, DATA_ARRAY, Le) +.

    For example, when you call:

    ubyte [] buffer = apdu.getBuffer)

    So it means that the values of bytes inside the tableau_donnees argument automatically occupy locations + buffer [ISO7816. OFFSET_CDATA] + inside the buffer?

    Yes. The length would be (abstract) (buffer [ISO7816. (OFFSET_LC] & 0xFF) . Notice the & 0xFF is a must greater than 127 bytes.

    Or there is a mechanism to extract the table tableau_donnees itself?

    Laughing out loud

    In fact, in the interest of performance and portability in environments with low memory, usual coding style must pass buffer , an offset that and length; rather than take an object, which would require a copy. Welcome to the real world of Java Card.

  • 5132: "the format of the string is not supported.

    Hello

    I'm listening channels of my new USB-5132 on the disk at the same time, using the c# example "scope: live stream To Disk.  I entered "0:1" (without the quotes) in the channel name box.  The result is the error "the format of the string is not supported.  Is there another syntax or example that will allow me to broadcast two channels of 5132 on disk?

    Thank you

    Penny

    Hi Penny,

    Channel string syntax

    If you try an empty string or a string separated by commas (as in "0.1") do you still see this error?

    What version of NOR-SCOPE do you use?  You can find it in Measure & Automation Explorer under software.

    Also, I would be interested to know if you have other devices (besides the 5132) which show the same behavior.

    -Andrew

Maybe you are looking for