• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to make an array of byte[]

 
mohamed reda shafy aboud
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone

can any one help me to make an array to add some anther byte[] in it as elements;

another question if i need to make an array to contain different types as String and byte[] and send it from server class to client class via socket ; is that possible and how can i do this

thanks for your help in advance
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mohamed reda shafy aboud wrote: . . . make an array to contain different types as String and byte[] . . . is that possible . . .
Only if you create it as an Object[]. And you can't add bytes to an Object[].
And please choose appropriate smilies.
 
J. Insi
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
he3.

the main thing that I can say is
that any String can be translated into byte []

I'm not kidding. Just use

 
Alex Hurtt
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:
mohamed reda shafy aboud wrote: . . . make an array to contain different types as String and byte[] . . . is that possible . . .
And you can't add bytes to an Object[].


Normally you can't except that auto-boxing makes it possible. And while you cannot add primitives to Object[]'s without auto-boxing, you can add byte[]'s to Object[]'s just fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic