import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
-import org.opendaylight.protocol.util.ByteArray;
import java.nio.ByteBuffer;
private static final byte headerEnd = (byte) 0x0a;
- public static final int MIN_HEADER_LENGTH = 4; // bytes
-
- public static final int MAX_HEADER_LENGTH = 13; // bytes
-
private boolean parsed = false;
public NetconfMessageHeader() {
// the length should be only numbers and therefore easily parsed with
// ASCII
this.length = Long.parseLong(Charsets.US_ASCII.decode(
- ByteBuffer.wrap(ByteArray.subByte(bytes, headerBegin.length, bytes.length - headerBegin.length - 1)))
- .toString());
+ ByteBuffer.wrap(bytes, headerBegin.length, bytes.length - headerBegin.length - 1)).toString());
Preconditions.checkState(this.length < Integer.MAX_VALUE && this.length > 0);
this.parsed = true;
return this;