Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #21828

How to remove this issue about NumberFormatException?

Newsgroups comp.lang.java.programmer
Date 2013-01-29 00:09 -0800
Message-ID <5d71bb47-c763-403a-8405-89708b399442@sb6g2000pbb.googlegroups.com> (permalink)
Subject How to remove this issue about NumberFormatException?
From bluestar <bluestar8783@gmail.com>

Show all headers | View raw


Hi, all:

    I am rookie for coding java and I have one question about queue
class

    I use one queue class: ArrayBlockingQueue to save/get my data

    I read some data from HW and save into one ArrayBlockingQueue, and
then get from this ArrayBlockingQueue when needing. But it has one
error message: <java.lang.NumberFormatException: Invalid int:
"ffffff94"> when doing poll function

    My simple code is  below

    private ArrayBlockingQueue<Byte> iReadQueueArray = new
ArrayBlockingQueue<Byte>(READBUF_SIZE, true);

    byte[] rbuf = new byte[256];

    iReadCnt = readfromHW(rbuf, rbuf.length); <---read data from
HW
    ret = iReadQueueArray.offer( Byte.valueOf( (rbuf[i]&0xFF) ));

//-----------------------------------------------------------------------//
    public int read(byte[] buf) {
      Byte  mdata;
      ...
      mdata = (Byte)iReadQueueArray.poll(); <---occur error when
polling some data
      if( mdata!=null ) {
          buf[i] =  (byte) (mdata.byteValue()&0xFF);
      }
      ...
      return 0;
    }
//-----------------------------------------------------------------------//

    How to modify offer data into the queue and poll data from the
queue?

    Thank you for your help!

BR,
Alan

Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar | Unroll thread


Thread

How to remove this issue about NumberFormatException? bluestar <bluestar8783@gmail.com> - 2013-01-29 00:09 -0800
  Re: How to remove this issue about NumberFormatException? bluestar <bluestar8783@gmail.com> - 2013-01-29 01:09 -0800
    Re: How to remove this issue about NumberFormatException? Roedy Green <see_website@mindprod.com.invalid> - 2013-01-29 02:15 -0800
      Re: How to remove this issue about NumberFormatException? Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-29 06:38 -0400
        Re: How to remove this issue about NumberFormatException? Roedy Green <see_website@mindprod.com.invalid> - 2013-01-30 04:55 -0800
          Re: How to remove this issue about NumberFormatException? Lew <lewbloch@gmail.com> - 2013-01-30 08:35 -0800
            Re: How to remove this issue about NumberFormatException? Roedy Green <see_website@mindprod.com.invalid> - 2013-01-31 04:21 -0800

csiph-web