public class ZrtpUtils extends Object
| Constructor and Description |
|---|
ZrtpUtils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
byteArrayCompare(byte[] arg1,
byte[] arg2,
int length) |
static char[] |
bytesToHexString(byte[] in,
int length) |
static void |
hexdump(String title,
byte[] buf,
int len)
Dump a buffer in hex and readable format.
|
static byte[] |
int32ToArray(int data)
Convert a 32 bit integer into a byte array, network order.
|
static void |
int32ToArrayInPlace(int data,
byte[] buffer,
int offset)
Convert a 32 bit integer into a byte array, network order.
|
static int |
readInt(byte[] buffer,
int offset)
Extract four bytes from a buffer and convert into an integer.
|
static byte[] |
readRegion(byte[] buffer,
int offset,
int length)
Read a byte region from specified offset with specified length
|
static short |
readShort(byte[] buffer,
int offset)
Extract two bytes from a buffer and convert into a short integer.
|
static byte[] |
short16ToArray(int data)
Convert a 16 bit integer into a byte array, network order.
|
static void |
short16ToArrayInPlace(int data,
byte[] buffer,
int offset)
Convert a 16 bit integer into a byte array, network order.
|
public static byte[] int32ToArray(int data)
data - the 32 bit integer to send over the networkpublic static void int32ToArrayInPlace(int data,
byte[] buffer,
int offset)
data - the 32 bit integer to send over the networkbuffer - the byte array that receives the converted integeroffset - the offset into the bufferpublic static byte[] short16ToArray(int data)
data - the 16 bit integer to send over the networkpublic static void short16ToArrayInPlace(int data,
byte[] buffer,
int offset)
data - the 16 bit integer to send over the networkpublic static short readShort(byte[] buffer,
int offset)
buffer - The buffer containing the bytes in network order.offset - Offset into buffer.public static int readInt(byte[] buffer,
int offset)
buffer - The buffer containing the bytes in network order.offset - Offset into buffer.public static byte[] readRegion(byte[] buffer,
int offset,
int length)
buffer - the buffer to copy fromoffset - start offset of the region to be readlength - length of the region to be readpublic static void hexdump(String title, byte[] buf, int len)
title - Printed at the beginning of the dumpbuf - Byte buffer to dumplen - Number of bytes to dump, should be less or equal
the buffer lengthpublic static char[] bytesToHexString(byte[] in,
int length)
public static int byteArrayCompare(byte[] arg1,
byte[] arg2,
int length)
Copyright © 2020. All rights reserved.