| | |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * Copyright 2014 ForgeRock AS |
| | | * Copyright 2014-2015 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.protocol; |
| | | |
| | |
| | | */ |
| | | public ByteArrayBuilder appendBoolean(boolean b) |
| | | { |
| | | appendByte((byte) (b ? 1 : 0)); |
| | | appendByte(b ? 1 : 0); |
| | | return this; |
| | | } |
| | | |
| | |
| | | * the byte to append. |
| | | * @return this ByteArrayBuilder |
| | | */ |
| | | public ByteArrayBuilder appendByte(byte b) |
| | | public ByteArrayBuilder appendByte(int b) |
| | | { |
| | | builder.append(b); |
| | | builder.appendByte(b); |
| | | return this; |
| | | } |
| | | |
| | |
| | | * the short to append. |
| | | * @return this ByteArrayBuilder |
| | | */ |
| | | public ByteArrayBuilder appendShort(short s) |
| | | public ByteArrayBuilder appendShort(int s) |
| | | { |
| | | builder.append(s); |
| | | builder.appendShort(s); |
| | | return this; |
| | | } |
| | | |
| | |
| | | */ |
| | | public ByteArrayBuilder appendInt(int i) |
| | | { |
| | | builder.append(i); |
| | | builder.appendInt(i); |
| | | return this; |
| | | } |
| | | |
| | |
| | | */ |
| | | public ByteArrayBuilder appendLong(long l) |
| | | { |
| | | builder.append(l); |
| | | builder.appendLong(l); |
| | | return this; |
| | | } |
| | | |
| | |
| | | public ByteArrayBuilder appendStrings(Collection<String> col) |
| | | { |
| | | //appendInt() would have been safer, but byte is compatible with legacy code |
| | | appendByte((byte) col.size()); |
| | | appendByte(col.size()); |
| | | for (String s : col) |
| | | { |
| | | appendString(s); |
| | |
| | | */ |
| | | public ByteArrayBuilder appendByteArray(byte[] bytes) |
| | | { |
| | | builder.append(bytes); |
| | | builder.appendBytes(bytes); |
| | | return this; |
| | | } |
| | | |
| | |
| | | */ |
| | | public ByteArrayBuilder appendZeroTerminatedByteArray(byte[] bytes) |
| | | { |
| | | builder.append(bytes); |
| | | builder.appendBytes(bytes); |
| | | return appendZeroSeparator(); |
| | | } |
| | | |
| | | private ByteArrayBuilder appendZeroSeparator() |
| | | { |
| | | builder.append((byte) 0); |
| | | builder.appendByte(0); |
| | | return this; |
| | | } |
| | | |