Results 1 to 5 of 5
  1. #1
    shall is offline Senior Member
    Join Date
    Apr 2012
    Posts
    211
    Rep Power
    0

    Default Efficiently passing part of a byte array to a function?

    Hello,

    I want to pass only part of a byte array to another function. Is there any efficient way of doing this without having to performing a copy?

    Thanks,
    Stephen

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: Efficiently passing part of a byte array to a function?

    Quote Originally Posted by shall View Post
    Hello,

    I want to pass only part of a byte array to another function. Is there any efficient way of doing this without having to performing a copy?

    Thanks,
    Stephen

    ByteBuffer may be of interest.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Efficiently passing part of a byte array to a function?

    Pass the start and length of the part of interest along with the array.
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    shall is offline Senior Member
    Join Date
    Apr 2012
    Posts
    211
    Rep Power
    0

    Default Re: Efficiently passing part of a byte array to a function?

    Thanks,
    Stephen

  5. #5
    shall is offline Senior Member
    Join Date
    Apr 2012
    Posts
    211
    Rep Power
    0

    Default Re: Efficiently passing part of a byte array to a function?

    That will also work,
    Thanks,
    Stephen

Similar Threads

  1. Replies: 7
    Last Post: 04-06-2012, 12:15 AM
  2. Replies: 1
    Last Post: 10-21-2011, 11:55 AM
  3. Passing an object or string array as byte[]
    By AedonetLIRA in forum Advanced Java
    Replies: 0
    Last Post: 11-03-2010, 11:33 PM
  4. Passing an Array index into a function?
    By dpedroia15 in forum New To Java
    Replies: 3
    Last Post: 06-01-2010, 07:51 PM
  5. how use string array while passing to a function
    By sks9s9 in forum New To Java
    Replies: 2
    Last Post: 02-03-2009, 12:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •