APISonar


cn.hutool.core.lang.Console.log

> cn > hutool > core > lang > Console > log
cn APIs hutool APIs core APIs lang APIs Console APIs log APIs

Example 1
public void logTest(){
		Console.log();
		
		String[] a = {"abc", "bcd", "def"};
		Console.log(a);
		
		Console.log("This is Console log for {}.", "test");
	}
Example 2
private void debug(final String msg) {
		if (vDebug) {
			Console.log(msg);
		}
	}
Example 3
public void inputTest() {
		Console.log("Please input something: ");
		String input = Console.input();
		Console.log(input);
	}
Example 4
public void execTest() {
		String str = RuntimeUtil.execForStr("ipconfig");
		Console.log(str);
	}
Example 5
public void isDateTest() {
		String[] all = BuiltinFormats.getAll();
		for(int i = 0 ; i < all.length; i++) {
			Console.log("{} {}", i, all[i]);
		}
	}
Example 6
public void doWhileTest() {
		String name = Thread.currentThread().getName();
		while (true) {
			Console.log("Job {} while running...", name);
			ThreadUtil.sleep(2000);
		}
	}
Example 7
public boolean after(Object target, Method method, Object[] args, Object returnVal) {
		Console.log("Method [{}.{}] execute spend [{}]ms return value [{}]",
				target.getClass().getName(), //
				method.getName(), //
				interval.intervalMs(), //
				returnVal);
		return true;
	}
Example 8
private void show(Cache<String, String> cache) {
		Iterator<?> its = cache.iterator();

		while (its.hasNext()) {
			Object tt = its.next();
			Console.log(tt);
		}
	}
Example 9
public void selectTest2() {
		List<String[]> list = MathUtil.arrangementSelect(new String[] { "1", "1", "3", "4" });
		for (String[] strings : list) {
			Console.log(strings);
		}
	}
Example 10
public void toStringTest() {
		String str = "{\"code\": 500, \"data\":null}";
		JSONObject jsonObject = new JSONObject(str);
		Console.log(jsonObject);
		jsonObject.getConfig().setIgnoreNullValue(true);
		Console.log(jsonObject.toStringPretty());
	}
Example 11
public void concurrencyTesterTest() {
		ConcurrencyTester tester = ThreadUtil.concurrencyTest(100, new Runnable() {

			@Override
			public void run() {
				long delay = RandomUtil.randomLong(100, 1000);
				ThreadUtil.sleep(delay);
				Console.log("{} test finished, delay: {}", Thread.currentThread().getName(), delay);
			}
		});
		Console.log(tester.getInterval());
	}
Example 12
public void unzipTest() {
		File unzip = ZipUtil.unzip("f:/test/apache-maven-3.6.2.zip", "f:\\test");
		Console.log(unzip);
	}
Example 13
public void benchTest() {
		TimeInterval timer = DateUtil.timer();
		for (int i = 0; i < 1000000; i++) {
			IdUtil.simpleUUID();
		}
		Console.log(timer.interval());

		timer.restart();
		for (int i = 0; i < 1000000; i++) {
			UUID.randomUUID().toString().replace("-", "");
		}
		Console.log(timer.interval());
	}
Example 14
public void uploadTest() {
		Ftp ftp = new Ftp("looly.centos");
		
		List<String> ls = ftp.ls("/file");
		Console.log(ls);
		
		boolean upload = ftp.upload("/file/aaa", FileUtil.file("E:/qrcodeWithLogo.jpg"));
		Console.log(upload);
		
		IoUtil.close(ftp);
	}
Example 15
public void downloadPicTest() {
		String url = "http://wx.qlogo.cn/mmopen/vKhlFcibVUtNBVDjcIowlg0X8aJfHXrTNCEFBukWVH9ta99pfEN88lU39MKspCUCOP3yrFBH3y2NbV7sYtIIlon8XxLwAEqv2/0";
		HttpUtil.downloadFile(url, "e:/pic/t3.jpg");
		Console.log("ok");
	}
Example 16
public void getHttpsTest() {
		String body = HttpRequest.get("https://www.gjifa.com/pc/").execute().body();
		Console.log(body);
	}
Example 17
public void parseTest(){
		JSONArray jsonArray = JSONUtil.parseArray("[{\"a\":\"a\\x]");
		Console.log(jsonArray);
	}
Example 18
public void emptyTest() {
		File file = FileUtil.file("d:/empty.txt");
		String type = FileTypeUtil.getType(file);
		Console.log(type);
	}
Example 19
public void toUrlArrayTest() {
		File[] files = FileUtil.file("D:\\workspace").listFiles();
		
		URL[] urls = Convert.convert(URL[].class, files);
		
		for (URL url : urls) {
			Console.log(url.getPath());
		}
	}
Example 20
public void decodeTest() {
		String decode = QrCodeUtil.decode(FileUtil.file("e:/pic/qr.png"));
		Console.log(decode);
	}
Example 21
public void requestForMessageTest() throws SOAPException {
		SoapClient client = SoapClient.create("http://www.webxml.com.cn/WebServices/IpAddressSearchWebService.asmx")
				.setMethod("web:getCountryCityByIp", "http://WebXml.com.cn/")
				.setParam("theIpAddress", "218.21.240.106");
		
		SOAPMessage message = client.sendForMessage();
		Console.log(message.getSOAPBody().getTextContent());
	}
Example 22
public void postTest() {
		String result = HttpUtil.createPost("api.uhaozu.com/goods/description/1120448506").charset(CharsetUtil.UTF_8).execute().body();
		Console.log(result);
	}
Example 23
public void settingTestForAbsPath(){
		Setting setting = new Setting("d:\\excel-plugin\\other.setting", true);
		Console.log(setting.getStr("a"));
	}
Example 24
public void pageTest() throws SQLException {
		PageResult<Entity> result = Db.use("orcl").page(Entity.create("T_USER"), new Page(2, 10));
		for (Entity entity : result) {
			Console.log(entity.get("ID"));
		}
	}
Example 25
public void sftpTest() {
		Session session = JschUtil.getSession("looly.centos", 22, "root", "123456");
		Sftp sftp = JschUtil.createSftp(session);
		sftp.mkDirs("/opt/test/aaa/bbb");
		Console.log("OK");
	}