private int readByte() throws VertxException { if (pos + 1 >= in.length()) { throw new VertxException("Invalid DER: stream too short, missing tag"); } return in.getUnsignedByte(pos++); }
private void testSetUnsignedByte(Buffer buff) throws Exception { for (int i = 0; i < numSets; i++) { int val = Byte.MAX_VALUE + i; buff.setUnsignedByte(i, (short) val); } for (int i = 0; i < numSets; i++) { int val = Byte.MAX_VALUE + i; assertEquals(val, buff.getUnsignedByte(i)); } }
@Test public void testGetUnsignedByte() throws Exception { int bytesLen = 100; byte[] bytes = TestUtils.randomByteArray(bytesLen); Buffer b = Buffer.buffer(bytes); for (int i = 0; i < bytesLen; i++) { assertEquals(Byte.toUnsignedLong(bytes[i]), b.getUnsignedByte(i)); } }
throw new IllegalStateException("expected " + toHex(clientRequest) + ", got " + toHex(buffer2)); int addressType = buffer2.getUnsignedByte(3); String host; int port; throw new IllegalStateException("format error in client request (attribute type ipv4), got " + toHex(buffer2)); host = buffer2.getUnsignedByte(4) + "." + buffer2.getUnsignedByte(5) + "." + buffer2.getUnsignedByte(6) + "." + buffer2.getUnsignedByte(7); port = buffer2.getUnsignedShort(8); } else if(addressType == 3) { int stringLen = buffer2.getUnsignedByte(4); log.debug("string len " + stringLen); if (buffer2.length() != 7 + stringLen) {
private int readByte() throws VertxException { if (pos + 1 >= in.length()) { throw new VertxException("Invalid DER: stream too short, missing tag"); } return in.getUnsignedByte(pos++); }
protected static Buffer normalizeLineEndingsFor(Buffer buff) { int buffLen = buff.length(); Buffer normalized = Buffer.buffer(buffLen); for (int i = 0; i < buffLen; i++) { short unsignedByte = buff.getUnsignedByte(i); if (unsignedByte != '\r' || i + 1 == buffLen || buff.getUnsignedByte(i + 1) != '\n') { normalized.appendUnsignedByte(unsignedByte); } } return normalized; }
private void testSetUnsignedByte(Buffer buff) throws Exception { for (int i = 0; i < numSets; i++) { int val = Byte.MAX_VALUE + i; buff.setUnsignedByte(i, (short) val); } for (int i = 0; i < numSets; i++) { int val = Byte.MAX_VALUE + i; assertEquals(val, buff.getUnsignedByte(i)); } }
@Test public void testGetUnsignedByte() throws Exception { int bytesLen = 100; byte[] bytes = TestUtils.randomByteArray(bytesLen); Buffer b = Buffer.buffer(bytes); for (int i = 0; i < bytesLen; i++) { assertEquals(Byte.toUnsignedLong(bytes[i]), b.getUnsignedByte(i)); } }
/** * Returns the unsigned <code>byte</code> at position <code>pos</code> in the Buffer, as a <code>short</code>. * @param pos * @return */ public short getUnsignedByte(int pos) { short ret = delegate.getUnsignedByte(pos); return ret; }
/** * Returns the unsigned <code>byte</code> at position <code>pos</code> in the Buffer, as a <code>short</code>. * @param pos * @return */ public short getUnsignedByte(int pos) { short ret = delegate.getUnsignedByte(pos); return ret; }
protected static Buffer normalizeLineEndingsFor(final Buffer buff) { final int buffLen = buff.length(); final Buffer normalized = Buffer.buffer(buffLen); for (int i = 0; i < buffLen; i++) { final short unsignedByte = buff.getUnsignedByte(i); if (unsignedByte != '\r' || i + 1 == buffLen || buff.getUnsignedByte(i + 1) != '\n') { normalized.appendUnsignedByte(unsignedByte); } } return normalized; }
protected static Buffer normalizeLineEndingsFor(final Buffer buff) { final int buffLen = buff.length(); final Buffer normalized = Buffer.buffer(buffLen); for (int i = 0; i < buffLen; i++) { final short unsignedByte = buff.getUnsignedByte(i); if (unsignedByte != '\r' || i + 1 == buffLen || buff.getUnsignedByte(i + 1) != '\n') { normalized.appendUnsignedByte(unsignedByte); } } return normalized; }
throw new IllegalStateException("expected " + toHex(clientRequest) + ", got " + toHex(buffer2)); int addressType = buffer2.getUnsignedByte(3); String host; int port; throw new IllegalStateException("format error in client request (attribute type ipv4), got " + toHex(buffer2)); host = buffer2.getUnsignedByte(4) + "." + buffer2.getUnsignedByte(5) + "." + buffer2.getUnsignedByte(6) + "." + buffer2.getUnsignedByte(7); port = buffer2.getUnsignedShort(8); } else if(addressType == 3) { int stringLen = buffer2.getUnsignedByte(4); log.debug("string len " + stringLen); if (buffer2.length() != 7 + stringLen) {
protected static Buffer normalizeLineEndingsFor(Buffer buff) { int buffLen = buff.length(); Buffer normalized = Buffer.buffer(buffLen); for (int i = 0; i < buffLen; i++) { short unsignedByte = buff.getUnsignedByte(i); if (unsignedByte != '\r' || i + 1 == buffLen || buff.getUnsignedByte(i + 1) != '\n') { normalized.appendUnsignedByte(unsignedByte); } } return normalized; }