本文整理了Java中org.kaazing.k3po.lang.el.Function
类的一些代码示例,展示了Function
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Function
类的具体详情如下:
包路径:org.kaazing.k3po.lang.el.Function
类名称:Function
暂无
代码示例来源:origin: k3po/k3po
@Function
public static byte[] allBytes() {
byte[] bytes = new byte[256];
for (int i = 0; i < 256; i++) {
bytes[i] = (byte) i;
}
return bytes;
}
代码示例来源:origin: k3po/k3po
protected Reflective(Class<?> functions) {
Map<String, Method> functionsAsMap = new HashMap<>();
for (Method method : functions.getMethods()) {
if (isStatic(method.getModifiers())) {
Function annotation = method.getAnnotation(Function.class);
if (annotation != null) {
String localName = annotation.name();
if (localName == null || localName.isEmpty()) {
localName = method.getName();
}
if (functionsAsMap.containsKey(localName)) {
throw new ELException(String.format("Duplicate @Function name: %s", localName));
}
functionsAsMap.put(localName, method);
}
}
}
this.functions = functionsAsMap;
}
代码示例来源:origin: k3po/k3po
@Function
public static byte[] portXOR(int port) {
byte[] x = new byte[2];
byte one = (byte)(port >> 8);
byte two = (byte)(port);
x[0] = (byte)(one ^ 0x21); // magic cookie byte 1
x[1] = (byte)(two ^ 0x12); // magic cookie byte 2
return x;
}
代码示例来源:origin: k3po/k3po
@Function
public static byte[] convertEscapedUtf8BytesToEscapedWindows1252(byte[] in) {
byte[] out = new byte[in.length];
for (int i = 0; i < in.length; i++) {
out[i] = in[i] == 0x00 ? 0x30 : in[i];
}
return out;
}
代码示例来源:origin: k3po/k3po
@Function
public static byte[] padding(int size) {
if ((size & 1) != 0) {
size += 1;
}
byte[] padding = new byte[size + 2];
padding[0] = 0x01;
for (int i = 1; i < padding.length - 2; i += 2) {
padding[i] = 0x30;
padding[i + 1] = 0x30;
}
padding[padding.length - 1] = (byte) 0xFF;
return padding;
}
代码示例来源:origin: k3po/k3po
@Function
public static byte[] randomBytes(int length) {
byte[] bytes = new byte[length];
for (int i = 0; i < length; i++) {
bytes[i] = (byte) RANDOM.nextInt(0x100);
}
return bytes;
}
代码示例来源:origin: k3po/k3po
@Function
public static byte[] randomBytes(int length) {
byte[] bytes = new byte[length];
for (int i = 0; i < length; i++) {
bytes[i] = (byte) RANDOM.nextInt(0x100);
}
return bytes;
}
代码示例来源:origin: k3po/k3po
@Function
public static String asString(int value) {
return Integer.toString(value);
}
代码示例来源:origin: k3po/k3po
@Function
public static byte[] copyOfRange(byte[] original, int from, int to) {
return Arrays.copyOfRange(original, from, to);
}
代码示例来源:origin: k3po/k3po
@Function
public static byte[] generateTransactionId() {
byte[] bytes = new byte[12];
for (int i = 0; i < 12; i++) {
bytes[i] = (byte) RANDOM.nextInt(0x100);
}
return bytes;
}
代码示例来源:origin: k3po/k3po
@Function
public static byte[] randomBytes(int length) {
byte[] bytes = new byte[length];
for (int i = 0; i < length; i++) {
bytes[i] = (byte) RANDOM.nextInt(0x100);
}
return bytes;
}
代码示例来源:origin: k3po/k3po
@Function
public static byte[] randomBytes(int length) {
byte[] bytes = new byte[length];
for (int i = 0; i < length; i++) {
bytes[i] = (byte) RANDOM.nextInt(0x100);
}
return bytes;
}
代码示例来源:origin: k3po/k3po
@Function
public static int randomInt(int upperBound) {
return RANDOM.nextInt(upperBound);
}
代码示例来源:origin: k3po/k3po
@Function
public static byte[] randomBytesIncludingNumberOfEscapedBytes(int length, int numberOfEscapedBytesToInclude) {
byte[] bytes = new byte[length];
byte[] escapedBytes = {0b00000000, 0b00001101, 0b00001010, 0b01111111};
for (int i = 0; i < length; i++) {
if ((length - i) / 2 < numberOfEscapedBytesToInclude) {
bytes[i] = escapedBytes[RANDOM.nextInt(escapedBytes.length)];
numberOfEscapedBytesToInclude--;
} else {
byte randomByte = (byte) RANDOM.nextInt(100);
switch (randomByte) {
case 0b00000000:
case 0b00001101:
case 0b00001010:
case 0b01111111:
if (numberOfEscapedBytesToInclude > 0) {
bytes[i] = randomByte;
numberOfEscapedBytesToInclude--;
} else {
i--;
}
break;
default:
bytes[i] = randomByte;
}
}
}
return bytes;
}
代码示例来源:origin: k3po/k3po
@Function
public static String randomMethodNot(String method) {
String[] methods = new String[]{"GET", "OPTIONS", "HEAD", "POST", "PUT", "DELETE", "TRACE", "CONNECT"};
String result;
do {
result = methods[RANDOM.nextInt(methods.length)];
} while (result.equalsIgnoreCase(method));
return result;
}
代码示例来源:origin: k3po/k3po
@Function
public static String append(String... strings) {
StringBuilder result = new StringBuilder();
for (String string : strings) {
result.append(string);
}
return result.toString();
}
代码示例来源:origin: k3po/k3po
@Function
public static String append(String... strings) {
StringBuilder x = new StringBuilder();
for (String s:strings) {
x.append(s);
}
return x.toString();
}
代码示例来源:origin: k3po/k3po
@Function
public static String append(String... strings) {
StringBuilder x = new StringBuilder();
for (String s:strings) {
x.append(s);
}
return x.toString();
}
代码示例来源:origin: k3po/k3po
@Function
public static String getDate() {
SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss");
return format.format(new Date()) + " GMT";
}
代码示例来源:origin: k3po/k3po
@Function
public static String append(String... strings) {
StringBuilder x = new StringBuilder();
for (String s:strings) {
x.append(s);
}
return x.toString();
}
内容来源于网络,如有侵权,请联系作者删除!