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


Java StringUtils.UTF8属性代码示例

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


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

示例1: from

private static String from(InputStream is) throws IOException {
    if (is == null)
        return "";
    StringBuilder sb = new StringBuilder();
    try {
        BufferedReader reader = new BufferedReader(
                new InputStreamReader(is, StringUtils.UTF8));
        String line;
        while ((line = reader.readLine()) != null) {
            sb.append(line);
        }
    } finally {
        is.close();
    }
    return sb.toString();
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:16,代码来源:S3ObjectWrapper.java

示例2: convertStreamToString

/**
 * Converts the contents of an input stream to a String
 */
private static String convertStreamToString(InputStream inputStream)
        throws IOException {
    if (inputStream == null) {
        return "";
    } else {
        StringBuilder stringBuilder = new StringBuilder();
        String line;
        try {
            BufferedReader reader =
                new BufferedReader(new InputStreamReader(inputStream,
                        StringUtils.UTF8));
            while ((line = reader.readLine()) != null) {
                stringBuilder.append(line);
            }
        } finally {
            inputStream.close();
        }
        return stringBuilder.toString();
    }
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:23,代码来源:ContentCryptoMaterial.java

示例3: loadAndReplaceMimetypes

/**
 * Reads and stores the mime type setting corresponding to a file extension, by reading
 * text from an InputStream. If a mime type setting already exists when this method is run,
 * the mime type value is replaced with the newer one.
 *
 * @param is
 *
 * @throws IOException
 */
public void loadAndReplaceMimetypes(InputStream is) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(is,
            StringUtils.UTF8));
    String line =  null;

    while ((line = br.readLine()) != null) {
        line = line.trim();

        if (line.startsWith("#") || line.length() == 0) {
            // Ignore comments and empty lines.
        } else {
            StringTokenizer st = new StringTokenizer(line, " \t");
            if (st.countTokens() > 1) {
                String mimetype = st.nextToken();
                while (st.hasMoreTokens()) {
                    String extension = st.nextToken();
                    extensionToMimetypeMap.put(StringUtils.lowerCase(extension), mimetype);
                    if (log.isDebugEnabled()) {
                        log.debug("Setting mime type for extension '" + StringUtils.lowerCase(extension) + "' to '" + mimetype + "'");
                    }
                }
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("Ignoring mimetype with no associated file extensions: '" + line + "'");
                }
            }
        }
    }
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:38,代码来源:Mimetypes.java

示例4: getRawResponseContent

/**
 * Typically only useful for debugging purpose if for some reason the SDK cannot parse the HTTP
 * response from a service
 *
 * @return The raw content of the HTTP response as a String.
 */
public String getRawResponseContent() {
    return rawResponse == null ? null : new String(rawResponse, StringUtils.UTF8);
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:9,代码来源:AmazonServiceException.java


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