• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How do you convert a byte array to a int or long, NSNumber has not byte init method.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do you convert a byte array to a int or long, NSNumber has not byte init method.


  • Subject: Re: How do you convert a byte array to a int or long, NSNumber has not byte init method.
  • From: "Shawn Erickson" <email@hidden>
  • Date: Mon, 7 May 2007 11:21:17 -0700

On 5/7/07, Shawn Erickson <email@hidden> wrote:
On 5/7/07, Martin <email@hidden> wrote:
> I want to create a int or long from a series of bytes that are in a
> NSData object.  It does not appear that a NSNumber object can be
> created from a byte array, I normally use Java and could create a
> BigDecimal using a byte array in the constructor.
>
> What data type do I use to create a buffer for the call [dataObject
> getBytes:buff range:aRange]
>
> I know that the range I want is either 4 or 2 bytes, i.e.
> NSRange fourBytes = {8,4}
> NSRange twoBytes = {16, 2}

UInt12 twoByteValue;

Oops... typo... make that UInt16. _______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >How do you convert a byte array to a int or long, NSNumber has not byte init method. (From: Martin <email@hidden>)
 >Re: How do you convert a byte array to a int or long, NSNumber has not byte init method. (From: "Shawn Erickson" <email@hidden>)

  • Prev by Date: Re: How do you convert a byte array to a int or long, NSNumber has not byte init method.
  • Next by Date: Re: Leaks with Core-Data while fetching data
  • Previous by thread: Re: How do you convert a byte array to a int or long, NSNumber has not byte init method.
  • Next by thread: Java drawing into a NSView
  • Index(es):
    • Date
    • Thread