BowlerKernel
ByteData.java
Go to the documentation of this file.
1 package com.neuronrobotics.sdk.bootloader;
2 
3 import java.util.ArrayList;
4 
5 // TODO: Auto-generated Javadoc
9 public class ByteData {
10 
12  private long address;
13 
15  private ArrayList<Byte> dataBytes = new ArrayList<Byte>();
16 
22  public ByteData(long address){
23  this.setAddress(address);
24  }
25 
31  private void setAddress(long address) {
32  this.address = address;
33  }
34 
40  public long getStartAddress() {
41  return address;
42  }
43 
49  public long getEndAddress() {
50  return address+dataBytes.size();
51  }
52 
58  public void setData(byte data) {
59  dataBytes.add(new Byte(data));
60  }
61 
67  public byte [] getData() {
68  byte [] b = new byte[dataBytes.size()];
69  int i=0;
70  for (Byte bld:dataBytes){
71  b[i++]=bld.byteValue();
72  }
73  return b;
74  }
75 
76  /* (non-Javadoc)
77  * @see java.lang.Object#toString()
78  */
79  public String toString(){
80  return "Address: "+address+" Number of bytes:" + dataBytes.size()+" Data: "+dataBytes;
81  }
82 }