org.seasar.kvasir.util.io.IOUtils.readString()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.seasar.kvasir.util.io.IOUtils.readString()方法的一些代码示例,展示了IOUtils.readString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.readString()方法的具体详情如下:
包路径:org.seasar.kvasir.util.io.IOUtils
类名称:IOUtils
方法名:readString

IOUtils.readString介绍

暂无

代码示例

代码示例来源:origin: org.seasar.ymir/ymir-testing

protected String readResource(Class<?> testClass, String name) {
  String className = testClass.getName();
  int dot = className.lastIndexOf('.');
  if (dot >= 0) {
    className = className.substring(dot + 1);
  }
  return IOUtils.readString(getClass().getResourceAsStream(
      className + "_" + name), "UTF-8", false);
}

代码示例来源:origin: org.seasar.kvasir.page.ability.content/org.seasar.kvasir.page.ability.content

public String toHTML(InputStream in, String encoding, String type,
  VariableResolver resolver)
{
  if (in == null) {
    return null;
  }
  if (encoding == null) {
    encoding = ENCODING_DEFAULT;
  }
  return engine_.evaluate(IOUtils.readString(in, encoding, false));
}

代码示例来源:origin: org.seasar.kvasir.page/org.seasar.kvasir.page

public String readText(String resourceName)
  {
    String resourcePath = getClass().getName().replace('.', '/')
      .concat("_").concat(resourceName);
    InputStream in = getClass().getClassLoader().getResourceAsStream(
      resourcePath);
    if (in == null) {
      throw new IORuntimeException("Specified resource does not exist: "
        + resourcePath);
    }
    return IOUtils.readString(in, "UTF-8", true);
  }
}

代码示例来源:origin: org.seasar.kvasir/kvasir-util

public static String readString(InputStream in, String encoding,
  boolean normalizeLineSeparator)
{
  if (in == null) {
    return null;
  }
  try {
    return readString(new InputStreamReader(in, encoding),
      normalizeLineSeparator);
  } catch (UnsupportedEncodingException ex) {
    throw new IORuntimeException(ex);
  }
}

代码示例来源:origin: org.seasar.kvasir.page.ability.content/org.seasar.kvasir.page.ability.content

public String toHTML(InputStream in, String encoding, String type,
  VariableResolver resolver)
{
  if (in == null) {
    return null;
  }
  if (type != null && !type.startsWith("text/")) {
    // バイナリコンテントの場合は適当に返す。
    return type;
  }
  if (encoding == null) {
    encoding = ENCODING_DEFAULT;
  }
  String str = IOUtils.readString(in, encoding, false);
  if ("text/html".equals(type)) {
    return HTMLUtils.stripHTML(str);
  } else {
    return HTMLUtils.filterLines(str, true);
  }
}

代码示例来源:origin: org.seasar.kvasir.page.ability.content/org.seasar.kvasir.page.ability.content

public String getBodyString()
{
  return IOUtils.readString(getBodyInputStream(), getEncoding(), false);
}

代码示例来源:origin: org.seasar.cms.ymir/ymir-extension

public Response act(Request request, PathMetaData pathMetaData) {
  String resourcePath = getResourcePath(pathMetaData);
  if (resourcePath == null) {
    return VoidResponse.INSTANCE;
  }
  InputStream in = getClass().getClassLoader().getResourceAsStream(
      PACKAGE_PREFIX_RESOURCE + resourcePath);
  if (in == null) {
    return VoidResponse.INSTANCE;
  } else {
    if (resourcePath.equals(PATH_SOURCECREATOR_JS)) {
      try {
        in = new ByteArrayInputStream(IOUtils.readString(in,
            "UTF-8", false).replace(MARK_CONTEXTPATH,
            request.getContextPath()).getBytes("UTF-8"));
      } catch (UnsupportedEncodingException ex) {
        throw new RuntimeException("Can't happen!", ex);
      }
    }
    String contentType = sourceCreator_.getServletContext()
        .getMimeType(resourcePath);
    if (contentType == null) {
      contentType = DEFAULT_CONTENTTYPE;
    }
    return new SelfContainedResponse(in, contentType);
  }
}

代码示例来源:origin: org.seasar.kvasir/kvasir-util

return IOUtils.readString(
    new InputStreamReader(bis, actualCharset), false);
} catch (IOException ex) {

代码示例来源:origin: org.seasar.kvasir/kvasir-util

public static String readString(Resource resource, String encoding,
  boolean normalizeLineSeparator, String defaultString)
{
  if (resource == null || !resource.exists() || resource.isDirectory()) {
    return defaultString;
  }
  try {
    return IOUtils.readString(resource.getInputStream(), encoding,
      normalizeLineSeparator);
  } catch (ResourceNotFoundException ex) {
    return defaultString;
  }
}

代码示例来源:origin: org.seasar.kvasir.cms.pop/org.seasar.kvasir.cms.pop

String getString(I18NResource resource, Locale locale)
{
  if (resource != null && resource.exists(locale)) {
    try {
      return PropertyUtils.valueOf(IOUtils.readString(resource
        .getInputStream(locale), "UTF-8", false), "");
    } catch (ResourceNotFoundException ignore) {
      return null;
    }
  } else {
    return null;
  }
}

代码示例来源:origin: org.seasar.kvasir.page.ability.template/org.seasar.kvasir.page.ability.template

public void setAttribute(Page page, String name, String variant,
  Attribute attr)
{
  if (ATTR_TYPE.equals(name)) {
    if (Page.VARIANT_DEFAULT.equals(variant)) {
      String type = attr.getString(SUBNAME_DEFAULT);
      if (type != null) {
        setType(page, type);
      }
    }
  } else if (ATTR_RESPONSECONTENTTYPE.equals(name)) {
    if (Page.VARIANT_DEFAULT.equals(variant)) {
      String responseContentType = attr.getString(SUBNAME_DEFAULT);
      if (responseContentType != null) {
        setResponseContentType(page, responseContentType);
      }
    }
  } else if (ATTR_MODIFYDATE.equals(name)) {
    // modifyDateは今のところ復元できない。
  } else if (ATTR_BODY.equals(name)) {
    InputStreamFactory isf = attr.getStream(SUBNAME_DEFAULT);
    if (isf != null) {
      setTemplate(page, variant, IOUtils.readString(isf
        .getInputStream(), Template.ENCODING, false));
    }
  }
}

代码示例来源:origin: org.seasar.kvasir.cms.webdav/org.seasar.kvasir.cms.webdav

protected void setContent(PageElement element, String encoding,
    InputStream in)
    throws NamingException
  {
    element.getElement().getAbility(TemplateAbility.class).setTemplate(
      element.getVariant(), IOUtils.readString(in, encoding, false));
  }
}

代码示例来源:origin: org.seasar.kvasir.cms.pop/org.seasar.kvasir.cms.pop

public String findBody(String variant)
{
  if (body_ != null && body_.exists(variant)) {
    try {
      return PropertyUtils.valueOf(IOUtils.readString(body_
        .getInputStream(variant), "UTF-8", false), "");
    } catch (ResourceNotFoundException ignore) {
    }
  }
  return PropertyUtils.valueOf(getProperty0(PROP_BODY, variant), "");
}

代码示例来源:origin: org.seasar.kvasir.cms.webdav/org.seasar.kvasir.cms.webdav

protected void create(PageElement element, String encoding, InputStream in)
  throws NamingException
{
  TemplateAbility template = getPage(element, true, false).getAbility(
    TemplateAbility.class);
  template.setType(element.getType());
  template.setTemplate(element.getVariant(), IOUtils.readString(in,
    encoding, false));
}

代码示例来源:origin: org.seasar.kvasir.page.search/org.seasar.kvasir.page.search

parser = new HTMLParser(html);
log_.debug("INDEXED CONTENT:\n"
  + IOUtils.readString(parser.getReader(), false));

代码示例来源:origin: org.seasar.kvasir.cms.webdav/org.seasar.kvasir.cms.webdav

if (internalEncoding != null && !internalEncoding.equals(encoding)) {
  try {
    in = new ByteArrayInputStream(IOUtils.readString(in,
      encoding, false).getBytes(internalEncoding));
  } catch (UnsupportedEncodingException ex) {

代码示例来源:origin: org.seasar.kvasir.cms.webdav/org.seasar.kvasir.cms.webdav

&& !internalEncoding.equals(encoding)) {
try {
  in = new ByteArrayInputStream(IOUtils.readString(in,
    encoding, false).getBytes(internalEncoding));
} catch (UnsupportedEncodingException ex) {

相关文章