aspose file tools*
The moose likes Beginning Java and the fly likes how to make an array of byte[] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to make an array of byte[]" Watch "how to make an array of byte[]" New topic
Author

how to make an array of byte[]

mohamed reda shafy aboud
Greenhorn

Joined: Nov 13, 2010
Posts: 6
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

Joined: Oct 13, 2005
Posts: 36453
    
  15
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

Joined: Aug 11, 2010
Posts: 84
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

Joined: Oct 26, 2010
Posts: 98
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.
 
 
subject: how to make an array of byte[]
 
Similar Threads
make an array of byte[]
Conversion ?
simple question , please help me
byte[] to int
byte array to String