com.google.gwt.dev.util.Util.readStreamAsString()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(157)

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

Util.readStreamAsString介绍

暂无

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

public Void call() throws Exception {
  if (mode.isEmitClasses()) {
   String fileName = state.type.getInternalName();
   if (fileName == null) {
    System.err.println("Got null filename from " + state.type);
    return null;
   }
   fileName += ".class";
   emitter.emit(fileName, state.contents);
  }
  if (mode.isEmitSource()) {
   String sourcePath = getPackagePath(state.originalType) + state.source;
   String destPath = getPackagePath(state.type) + state.source;
   if (sources.add(sourcePath) && loader.exists(sourcePath)) {
    String contents = Util.readStreamAsString(loader.getResourceAsStream(sourcePath));
    emitter.emit(destPath, new ByteArrayInputStream(Util.getBytes(contents)));
   }
  }
  return null;
 }
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

@Override
public InputSource resolveEntity(String publicId, String systemId) {
 String matchingPrefix = findMatchingPrefix(systemId);
 Resource resource = null;
 if (matchingPrefix != null) {
  resource =
    resourceOracle.getResource(RESOURCES + systemId.substring(matchingPrefix.length()));
 }
 if (resource == null) {
  resource = resourceOracle.getResource(pathBase + systemId);
 }
 if (resource != null) {
  String content;
  try {
   InputStream resourceStream = resource.openContents();
   content = Util.readStreamAsString(resourceStream);
  } catch (IOException ex) {
   logger.log(TreeLogger.ERROR, "Error reading resource: " + resource.getLocation());
   throw new RuntimeException(ex);
  }
  InputSource inputSource = new InputSource(new StringReader(content));
  inputSource.setPublicId(publicId);
  inputSource.setSystemId(resource.getPath());
  return inputSource;
 }
 /*
  * Let Sax find it on the interweb.
  */
 return null;
}

代码示例来源:origin: net.wetheinter/gwt-user

@Override
public InputSource resolveEntity(String publicId, String systemId) {
 String matchingPrefix = findMatchingPrefix(systemId);
 Resource resource = null;
 if (matchingPrefix != null) {
  resource =
    resourceOracle.getResource(RESOURCES + systemId.substring(matchingPrefix.length()));
 }
 if (resource == null) {
  resource = resourceOracle.getResource(pathBase + systemId);
 }
 if (resource != null) {
  String content;
  try {
   InputStream resourceStream = resource.openContents();
   content = Util.readStreamAsString(resourceStream);
  } catch (IOException ex) {
   logger.log(TreeLogger.ERROR, "Error reading resource: " + resource.getLocation());
   throw new RuntimeException(ex);
  }
  InputSource inputSource = new InputSource(new StringReader(content));
  inputSource.setPublicId(publicId);
  inputSource.setSystemId(resource.getPath());
  return inputSource;
 }
 /*
  * Let Sax find it on the interweb.
  */
 return null;
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

public Void call() throws Exception {
  if (mode.isEmitClasses()) {
   String fileName = state.type.getInternalName();
   if (fileName == null) {
    System.err.println("Got null filename from " + state.type);
    return null;
   }
   fileName += ".class";
   emitter.emit(fileName, state.contents);
  }
  if (mode.isEmitSource()) {
   String sourcePath = getPackagePath(state.originalType) + state.source;
   String destPath = getPackagePath(state.type) + state.source;
   if (sources.add(sourcePath) && loader.exists(sourcePath)) {
    String contents = Util.readStreamAsString(loader.getResourceAsStream(sourcePath));
    emitter.emit(destPath, new ByteArrayInputStream(Util.getBytes(contents)));
   }
  }
  return null;
 }
}

代码示例来源:origin: net.wetheinter/gwt-user

public Void call() throws Exception {
  if (mode.isEmitClasses()) {
   String fileName = state.type.getInternalName();
   if (fileName == null) {
    System.err.println("Got null filename from " + state.type);
    return null;
   }
   fileName += ".class";
   emitter.emit(fileName, state.contents);
  }
  if (mode.isEmitSource()) {
   String sourcePath = getPackagePath(state.originalType) + state.source;
   String destPath = getPackagePath(state.type) + state.source;
   if (sources.add(sourcePath) && loader.exists(sourcePath)) {
    String contents = Util.readStreamAsString(loader.getResourceAsStream(sourcePath));
    emitter.emit(destPath, new ByteArrayInputStream(Util.getBytes(contents)));
   }
  }
  return null;
 }
}

代码示例来源:origin: com.jhickman/gwt-customuibinder

private Document getW3cDoc(MortalLogger logger, DesignTimeUtils designTime,
  ResourceOracle resourceOracle, String templatePath)
  throws UnableToCompleteException {
 Resource resource = resourceOracle.getResourceMap().get(templatePath);
 if (null == resource) {
  logger.die("Unable to find resource: " + templatePath);
 }
 Document doc = null;
 try {
  String content = designTime.getTemplateContent(templatePath);
  if (content == null) {
   content = Util.readStreamAsString(resource.openContents());
  }
  doc = new W3cDomHelper(logger.getTreeLogger(), resourceOracle).documentFor(
    content, resource.getPath());
 } catch (SAXParseException e) {
  logger.die(
    "Error parsing XML (line " + e.getLineNumber() + "): "
      + e.getMessage(), e);
 }
 return doc;
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

private Document getW3cDoc(MortalLogger logger, DesignTimeUtils designTime,
  ResourceOracle resourceOracle, String templatePath, Resource resource)
  throws UnableToCompleteException {
 Document doc = null;
 try {
  String content = designTime.getTemplateContent(templatePath);
  if (content == null) {
   content = Util.readStreamAsString(resource.openContents());
  }
  doc = new W3cDomHelper(logger.getTreeLogger(), resourceOracle).documentFor(
    content, resource.getPath());
 } catch (IOException iex) {
  logger.die("Error opening resource:" + resource.getLocation(), iex);
 } catch (SAXParseException e) {
  logger.die(
    "Error parsing XML (line " + e.getLineNumber() + "): "
      + e.getMessage(), e);
 }
 return doc;
}

代码示例来源:origin: net.wetheinter/gwt-user

private Document getW3cDoc(MortalLogger logger, DesignTimeUtils designTime,
  ResourceOracle resourceOracle, String templatePath, Resource resource)
  throws UnableToCompleteException {
 Document doc = null;
 try {
  String content = designTime.getTemplateContent(templatePath);
  if (content == null) {
   content = Util.readStreamAsString(resource.openContents());
  }
  doc = new W3cDomHelper(logger.getTreeLogger(), resourceOracle).documentFor(
    content, resource.getPath());
 } catch (IOException iex) {
  logger.die("Error opening resource:" + resource.getLocation(), iex);
 } catch (SAXParseException e) {
  logger.die(
    "Error parsing XML (line " + e.getLineNumber() + "): "
      + e.getMessage(), e);
 }
 return doc;
}

相关文章