How to read bytearray data from a linkedlist
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Shameer_Mohammed
Posted On:   Wednesday, April 2, 2008 02:32 AM



First doubt is can I add byte array data to a linked list .Then
I have store a byte array data into a linkedlist.
How to read data from a linked list byte by byte.
Pls revert me back with an example.Thank u

Re: How to read bytearray data from a linkedlist

Posted By:   piyush_nahata  
Posted On:   Friday, April 18, 2008 09:59 AM



public static void main(String args[]) throws IOException{

//This is your source of the byte array
byte[] byteArr = new byte[10];
for(byte i=0;i<10;i++){
byteArr[i] = i;
}

//Create a new List
List byteList = new LinkedList();
int noOfBytes = byteArr.length;

//Move data from ByteArray to ArrayList
for(int i=0;i byteList.add(byteArr[i]);
}

//Do Complex stuff with the data in the List
ListIterator iterator = byteList.listIterator();
while(iterator.hasNext()){
System.out.println(iterator.next());
}
}


Hope that helps
About | Sitemap | Contact