72 /** 73 * Constructs a new instance of BinaryRefAddr using its address type and a byte 74 * array for contents. 75 * 76 * @param addrType A non-null string describing the type of the address. 77 * @param src The non-null contents of the address as a byte array. 78 * The contents of src is copied into the new BinaryRefAddr. 79 */ 80 public BinaryRefAddr(String addrType, byte[] src) { 81 this(addrType, src, 0, src.length); 82 } 83 84 /** 85 * Constructs a new instance of BinaryRefAddr using its address type and 86 * a region of a byte array for contents. 87 * 88 * @param addrType A non-null string describing the type of the address. 89 * @param src The non-null contents of the address as a byte array. 90 * The contents of src is copied into the new BinaryRefAddr. 91 * @param offset The starting index in src to get the bytes. 92 * 0 <= offset <= src.length. 93 * @param count The number of bytes to extract from src. 94 * 0 <= count <= src.length-offset. 95 */ 96 public BinaryRefAddr(String addrType, byte[] src, int offset, int count) { 97 super(addrType); 98 buf = new byte[count]; 99 System.arraycopy(src, offset, buf, 0, count); 100 } 101 102 /** 103 * Retrieves the contents of this address as an Object. 104 * The result is a byte array. 105 * Changes to this array will affect this BinaryRefAddr's contents. 106 * Programs are recommended against changing this array's contents 107 * and to lock the buffer if they need to change it. 108 * 109 * @return The non-null buffer containing this address's contents. 110 */ 111 public Object getContent() { 112 return buf; 113 } 114 | 72 /** 73 * Constructs a new instance of BinaryRefAddr using its address type and a byte 74 * array for contents. 75 * 76 * @param addrType A non-null string describing the type of the address. 77 * @param src The non-null contents of the address as a byte array. 78 * The contents of src is copied into the new BinaryRefAddr. 79 */ 80 public BinaryRefAddr(String addrType, byte[] src) { 81 this(addrType, src, 0, src.length); 82 } 83 84 /** 85 * Constructs a new instance of BinaryRefAddr using its address type and 86 * a region of a byte array for contents. 87 * 88 * @param addrType A non-null string describing the type of the address. 89 * @param src The non-null contents of the address as a byte array. 90 * The contents of src is copied into the new BinaryRefAddr. 91 * @param offset The starting index in src to get the bytes. 92 * {@code 0 <= offset <= src.length}. 93 * @param count The number of bytes to extract from src. 94 * {@code 0 <= count <= src.length-offset}. 95 */ 96 public BinaryRefAddr(String addrType, byte[] src, int offset, int count) { 97 super(addrType); 98 buf = new byte[count]; 99 System.arraycopy(src, offset, buf, 0, count); 100 } 101 102 /** 103 * Retrieves the contents of this address as an Object. 104 * The result is a byte array. 105 * Changes to this array will affect this BinaryRefAddr's contents. 106 * Programs are recommended against changing this array's contents 107 * and to lock the buffer if they need to change it. 108 * 109 * @return The non-null buffer containing this address's contents. 110 */ 111 public Object getContent() { 112 return buf; 113 } 114 |