Code example for ByteArrayOutputStream

Methods: write

0
    public static void writeLength(ByteArrayOutputStream buf, int length) {
        // As per ETSI 102.220 Sec7.1.2, if the total length is greater 
        // than 0x7F, it should be coded in two bytes and the first byte 
        // should be 0x81. 
        if (length > 0x7F) {
            buf.write(0x81);
        } 
        buf.write(length);
    } 
} 
 
class SelectItemResponseData extends ResponseData { 
    // members 
    private int id;
 
    public SelectItemResponseData(int id) {
        super(); 
        this.id = id;
    } 
 
    @Override