本文整理汇总了Java中org.vertx.java.core.json.JsonArray.addArray方法的典型用法代码示例。如果您正苦于以下问题:Java JsonArray.addArray方法的具体用法?Java JsonArray.addArray怎么用?Java JsonArray.addArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.vertx.java.core.json.JsonArray
的用法示例。
在下文中一共展示了JsonArray.addArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testMinimal
import org.vertx.java.core.json.JsonArray; //导入方法依赖的package包/类
@Test
public void testMinimal() throws IOException {
// Config
JsonObject config = new JsonObject();
config.putString("delimiter", "<SPACE>");
config.putBoolean("trunc-dup-delimiters", true);
JsonObject mapping = new JsonObject();
JsonArray fields = new JsonArray();
fields.addArray(new JsonArray("[ \"permission\" ]"));
fields.addArray(new JsonArray("[ \"inodes\" ]"));
fields.addArray(new JsonArray("[ \"owner\" ]"));
fields.addArray(new JsonArray("[ \"group\" ]"));
fields.addArray(new JsonArray("[ \"size\" ]"));
fields.addArray(new JsonArray("[ \"modified\" ]"));
fields.addArray(new JsonArray("[ \"modified\", \"StrReplace(([0-9]+), $1)\" ]"));
fields.addArray(new JsonArray("[ \"modified\", \"StrReplace(([0-9]+\\\\:[0-9]+), $1)\" ]"));
fields.addArray(new JsonArray("[ \"file\" ]"));
mapping.putArray("fields", fields);
config.putObject("mapping", mapping);
String[] lines = {
"drwxr-x--- 4 john users 136 Oct 9 21:06 report.pdf",
"drwxrwxrwx 114 john users 1146 Aug 20 13:19 summary.pdf"
};
DsvLineParser parser = new DsvLineParser(createFilter(), config);
JsonObject[] events = parser.parse(lines);
for (JsonObject event : events) {
m_logger.info(event.encodePrettily());
}
}
示例2: testLongFormatDate
import org.vertx.java.core.json.JsonArray; //导入方法依赖的package包/类
@Test
public void testLongFormatDate() throws IOException {
// Config
JsonObject config = new JsonObject();
config.putString("delimiter", "<SPACE>");
config.putBoolean("trunc-dup-delimiters", true);
JsonObject mapping = new JsonObject();
JsonArray fields = new JsonArray();
fields.addArray(new JsonArray("[ \"job\" ]"));
fields.addArray(new JsonArray("[ \"user\" ]"));
fields.addArray(new JsonArray("[ \"size\" ]"));
fields.addArray(new JsonArray("[ \"submitted\" ]"));
fields.addArray(new JsonArray("[ \"submitted\", \"StrReplace((\\\\w+), $1)\" ]"));
fields.addArray(new JsonArray("[ \"submitted\", \"StrReplace(([0-9]+), $1)\" ]"));
fields.addArray(new JsonArray("[ \"submitted\", \"StrReplace(([0-9]+\\\\:[0-9]+\\\\:[0-9]+), $1)\" ]"));
fields.addArray(new JsonArray("[ \"submitted\", \"StrReplace(([0-9]+), $1)\" ]"));
mapping.putArray("fields", fields);
config.putObject("mapping", mapping);
String[] lines = {
"Xerox_WorkCentre_6015B-115 userx 453112 Tue Nov 18 21:50:51 2014",
"Xerox_WorkCentre_6015B-116 usery 683307 Tue Nov 18 21:50:52 2014"
};
DsvLineParser parser = new DsvLineParser(createFilter(), config);
JsonObject[] events = parser.parse(lines);
for (JsonObject event : events) {
m_logger.info(event.encodePrettily());
}
}
示例3: createDirConfig
import org.vertx.java.core.json.JsonArray; //导入方法依赖的package包/类
private JsonObject createDirConfig() {
// Command configuration
final JsonObject config = createBaseConfig();
if (HostOs.isWindows()) {
config.putString("encoding", "Windows-1252");
config.putNumber("skip-lines-start", 5);
config.putNumber("skip-lines-end", 3);
config.putString("command", "cmd");
JsonArray args = new JsonArray();
args.addString("/c");
args.addString("dir");
args.addString("/-c");
args.addString("/q");
args.addString("/a:d");
args.addString("/t:w");
config.putArray("args", args);
} else if (HostOs.isUnix()) {
config.putNumber("skip-lines-start", 1);
config.putString("command", "/bin/ls");
config.putArray("args", new JsonArray("[ \"-l\", \"-a\" ]"));
} else {
Assert.fail("Unsupported operating system: " + HostOs.operatingSystem());
}
config.putString("work-dir", "build");
// Output format
JsonObject outFormat = new JsonObject();
outFormat.putString("type", "dsv");
outFormat.putString("delimiter", "<SPACE>");
outFormat.putString("line-terminator", System.lineSeparator());
outFormat.putBoolean("trunc-dup-delimiters", true);
// Mapping
JsonObject mapping = new JsonObject();
JsonArray fields = new JsonArray();
if (HostOs.isWindows()) {
fields.addArray(new JsonArray("[ \"modified\" ]"));
fields.addArray(new JsonArray("[ \"modified\", \"StrReplace(([0-9:]+), $1)\" ]"));
fields.addArray(new JsonArray("[ \"dir\" ]"));
fields.addArray(new JsonArray("[ \"owner\" ]"));
fields.addArray(new JsonArray("[ \"file\" ]"));
} else {
fields.addArray(new JsonArray("[ \"permission\" ]"));
fields.addArray(new JsonArray("[ \"inodes\", \"Long\" ]"));
fields.addArray(new JsonArray("[ \"owner\" ]"));
fields.addArray(new JsonArray("[ \"group\" ]"));
fields.addArray(new JsonArray("[ \"size\", \"Long\" ]"));
fields.addArray(new JsonArray("[ \"modified\" ]"));
fields.addArray(new JsonArray("[ \"modified\", \"StrReplace(([0-9]+), $1)\" ]"));
fields.addArray(new JsonArray("[ \"modified\", \"StrReplace(([0-9]+\\\\:[0-9]+), $1)\" ]"));
fields.addArray(new JsonArray("[ \"file\" ]"));
}
mapping.putArray("fields", fields);
outFormat.putObject("mapping", mapping);
config.putObject("output-format", outFormat);
return config;
}