当前位置: 首页>>代码示例>>Java>>正文


Java Strings.EMPTY属性代码示例

本文整理汇总了Java中org.apache.logging.log4j.util.Strings.EMPTY属性的典型用法代码示例。如果您正苦于以下问题:Java Strings.EMPTY属性的具体用法?Java Strings.EMPTY怎么用?Java Strings.EMPTY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.logging.log4j.util.Strings的用法示例。


在下文中一共展示了Strings.EMPTY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: postToSendMessageEthereum

public static String postToSendMessageEthereum(String url, String sender, String receiver, String message, String amount)
        throws IOException {
    try {
        String params = String.format("{\"jsonrpc\":\"2.0\"," +
                        "\"method\":\"eth_sendTransaction\",\"params\":[{\"from\":\"%s\",\"to\":\"%s\"," +
                        "\"value\":\"%s\", \"data\":\"%s\"}],\"id\":%s}",
                sender, receiver, amount, "0x" + Hex.encodeHexString(message.getBytes()), id);

        String responseString = httpHelper.request(url, params, RequestType.POST);
        ObjectMapper mapper = new ObjectMapper();
        JsonNode responseJson = mapper.readTree(responseString);
        return responseJson.get("result").textValue();
    } catch (Exception e) {
        log.error("Cannot run post method for sending transactions in Ethereum", e);
    }

    return Strings.EMPTY;
}
 
开发者ID:dsx-tech,项目名称:blockchain-benchmarking,代码行数:18,代码来源:JSONRPCHelper.java

示例2: postToSendTransactionEthereum

public static String postToSendTransactionEthereum(String url, String sender, String receiver, String amount)
        throws IOException {

    try {
        String params = String.format("{\"jsonrpc\":\"2.0\"," +
                "\"method\":\"eth_sendTransaction\",\"params\":[{\"from\":\"%s\",\"to\":\"%s\"," +
                        "\"value\":\"%s\"}],\"id\":%s}",
                sender, receiver, amount, id);
        String responseString = httpHelper.request(url, params, RequestType.POST);
        ObjectMapper mapper = new ObjectMapper();
        JsonNode responseJson = mapper.readTree(responseString);
        return responseJson.get("result").textValue();
    } catch (Exception e) {
        log.error("Cannot run post method for sending transactions in Ethereum", e);
    }

    return Strings.EMPTY;
}
 
开发者ID:dsx-tech,项目名称:blockchain-benchmarking,代码行数:18,代码来源:JSONRPCHelper.java

示例3: testConfigurableBufferSize

@Test
public void testConfigurableBufferSize() throws IOException {
    final File file = File.createTempFile("log4j2", "test");
    file.deleteOnExit();
    try (final RandomAccessFile raf = new RandomAccessFile(file, "rw")) {
        final OutputStream os = NullOutputStream.getInstance();
        final boolean append = false;
        final boolean flushNow = false;
        final long triggerSize = 0;
        final long time = System.currentTimeMillis();
        final TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(triggerSize);
        final int bufferSize = 4 * 1024;
        assertNotEquals(bufferSize, RollingRandomAccessFileManager.DEFAULT_BUFFER_SIZE);
        final RolloverStrategy rolloverStrategy = null;
        final RollingRandomAccessFileManager manager = new RollingRandomAccessFileManager(null, raf,
                file.getName(), Strings.EMPTY, os, append, flushNow, bufferSize, triggerSize, time, triggerPolicy,
                rolloverStrategy, null, null, null, null, null, true);

        // check the resulting buffer size is what was requested
        assertEquals(bufferSize, manager.getBufferSize());
    }
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:22,代码来源:RollingRandomAccessFileManagerTest.java

示例4: createLogger

/**
 * Factory method to create a LoggerConfig.
 *
 * @param additivity True if additive, false otherwise.
 * @param level The Level to be associated with the Logger.
 * @param loggerName The name of the Logger.
 * @param includeLocation whether location should be passed downstream
 * @param refs An array of Appender names.
 * @param properties Properties to pass to the Logger.
 * @param config The Configuration.
 * @param filter A Filter.
 * @return A new LoggerConfig.
 * @deprecated Deprecated in 2.7; use {@link #createLogger(boolean, Level, String, String, AppenderRef[], Property[], Configuration, Filter)}
 */
@Deprecated
public static LoggerConfig createLogger(final String additivity,
        // @formatter:off
        final Level level,
        @PluginAttribute("name") final String loggerName,
        final String includeLocation,
        final AppenderRef[] refs,
        final Property[] properties,
        @PluginConfiguration final Configuration config,
        final Filter filter) {
        // @formatter:on
    if (loggerName == null) {
        LOGGER.error("Loggers cannot be configured without a name");
        return null;
    }

    final List<AppenderRef> appenderRefs = Arrays.asList(refs);
    final String name = loggerName.equals(ROOT) ? Strings.EMPTY : loggerName;
    final boolean additive = Booleans.parseBoolean(additivity, true);

    return new LoggerConfig(name, appenderRefs, filter, level, additive, properties, config,
            includeLocation(includeLocation));
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:37,代码来源:LoggerConfig.java

示例5: loadDefaults

@Override
protected void loadDefaults(final LoggingInitializationContext context, final LogFile file) {
    final String configFileName = "classpath:META-INF/log4j/default/log4j2"
        + ((file == null) ? Strings.EMPTY : "-file")
        + ".xml";
    loadConfiguration(context, configFileName, file);
}
 
开发者ID:apache,项目名称:logging-log4j-boot,代码行数:7,代码来源:Log4jLoggingSystem.java

示例6: getPatientId

@NotNull
private static String getPatientId(@NotNull final String runName) {
    final String[] names = runName.split("_");
    if (names.length < 5) {
        LOGGER.error("run name {} had less than 5 parts after splitting on _", runName);
        return Strings.EMPTY;
    }
    return names[4];
}
 
开发者ID:hartwigmedical,项目名称:hmftools,代码行数:9,代码来源:Utils.java

示例7: commonPrefix

@NotNull
private static String commonPrefix(String normal, String tumor, int maxLength) {
    int minLength = Math.min(maxLength, Math.min(tumor.length(), normal.length()));
    if (minLength == 0) {
        return Strings.EMPTY;
    }

    for (int i = 0; i < minLength; i++) {
        if (normal.charAt(i) != tumor.charAt(i)) {
            return i == 0 ? Strings.EMPTY : normal.substring(0, i);
        }
    }
    return normal.substring(0, minLength);
}
 
开发者ID:hartwigmedical,项目名称:hmftools,代码行数:14,代码来源:Microhomology.java

示例8: enforceMinLength

@NotNull
private static String[] enforceMinLength(@NotNull String[] parts, int minSize) {
    if (parts.length > minSize) {
        return parts;
    } else {
        final String[] values = new String[minSize];
        for (int i = 0; i < minSize; i++) {
            values[i] = i < parts.length ? parts[i] : Strings.EMPTY;
        }
        System.arraycopy(parts, 0, values, 0, parts.length);

        return values;
    }
}
 
开发者ID:hartwigmedical,项目名称:hmftools,代码行数:14,代码来源:VariantAnnotationFactory.java

示例9: sendMessage

private String sendMessage(String address, byte[] body) throws IOException {
    try {
        return JSONRPCHelper.post(url, BitcoinMethods.SENDTOADDRESS.name().toLowerCase(),
                address, BitcoinManager.toBigDecimal(body));
    } catch (InternalLogicException e) {
        log.error("Cannot send transaction", e);
    }
    return Strings.EMPTY;
}
 
开发者ID:dsx-tech,项目名称:blockchain-benchmarking,代码行数:9,代码来源:BitcoinManager.java

示例10: fromMetaDataFile

@Nullable
static RunContext fromMetaDataFile(@NotNull final String runDirectory) {
    final String metaDataFilePath = runDirectory + File.separator + METADATA_FILE;
    final JsonObject json;
    try {
        json = GSON.fromJson(new FileReader(metaDataFilePath), JsonObject.class);
    } catch (FileNotFoundException exception) {
        LOGGER.warn("Could not find meta data file: " + metaDataFilePath);
        return null;
    }

    final String refSample = fieldValue(json, REF_SAMPLE_FIELD);
    final String setName = fieldValue(json, SET_NAME_FIELD);

    if (refSample == null) {
        LOGGER.warn("Could not find " + REF_SAMPLE_FIELD + " in metadata file!");
        return null;
    } else if (setName == null) {
        LOGGER.warn("Could not find " + SET_NAME_FIELD + " in metadata file!");
        return null;
    } else {
        final String tumorSample = fieldValue(json, TUMOR_SAMPLE_FIELD);
        final boolean isSomaticRun = tumorSample != null && !tumorSample.equals(NO_TUMOR_SAMPLE);

        return new RunContextImpl(runDirectory, setName, refSample, isSomaticRun ? tumorSample : Strings.EMPTY,
                isSomaticRun);
    }
}
 
开发者ID:hartwigmedical,项目名称:hmftools,代码行数:28,代码来源:MetaDataResolver.java

示例11: getNewAddress

public String getNewAddress() throws IOException {
    try {
        String postResult = JSONRPCHelper.post(url, BitcoinMethods.GETNEWADDRESS.name().toLowerCase());
        if (postResult != null) {
            return postResult.replaceAll("^.|.$", "");
        }
    } catch (InternalLogicException e) {
        log.error("Cannot get new bitcoin wallet address", e);
    }
    return Strings.EMPTY;
}
 
开发者ID:dsx-tech,项目名称:blockchain-benchmarking,代码行数:11,代码来源:BitcoinManager.java

示例12: sendTransactionWithMessage

public String sendTransactionWithMessage(String from, String to, String message, String amount) {
    try {
        return JSONRPCHelper.postToSendMessageEthereum(url, from, to, message, amount);
    } catch (IOException e) {
        log.error("Cannot send message", e);
    }
    return Strings.EMPTY;
}
 
开发者ID:dsx-tech,项目名称:blockchain-benchmarking,代码行数:8,代码来源:EthereumManager.java

示例13: sendTransaction

@Override
public String sendTransaction(String from, String to, long amount) {
    try {
        return JSONRPCHelper.postToSendTransactionEthereum(url, from, to, Long.toString(amount));
    } catch (IOException e) {
        log.error("Cannot send message", e);
    }
    return Strings.EMPTY;
}
 
开发者ID:dsx-tech,项目名称:blockchain-benchmarking,代码行数:9,代码来源:EthereumManager.java

示例14: sendMessage

public String sendMessage(String address, long amount) throws IOException {
    try {
        return JSONRPCHelper.post(url, MultichainMethods.SEND.name().toLowerCase(),
                address, new BigDecimal(amount));
    } catch (InternalLogicException e) {
        log.error("Cannot send transaction", e);
    }
    return Strings.EMPTY;
}
 
开发者ID:dsx-tech,项目名称:blockchain-benchmarking,代码行数:9,代码来源:MultichainManager.java

示例15: getNewAddress

public String getNewAddress() throws IOException {
    try {
        String postResult = JSONRPCHelper.post(url, MultichainMethods.GETNEWADDRESS.name().toLowerCase());
        if (postResult != null) {
            return postResult.replaceAll("^.|.$", "");
        }
    } catch (InternalLogicException e) {
        log.error("Cannot get new bitcoin wallet address", e);
    }
    return Strings.EMPTY;
}
 
开发者ID:dsx-tech,项目名称:blockchain-benchmarking,代码行数:11,代码来源:MultichainManager.java


注:本文中的org.apache.logging.log4j.util.Strings.EMPTY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。