本文整理汇总了Java中org.w3c.css.sac.InputSource.setByteStream方法的典型用法代码示例。如果您正苦于以下问题:Java InputSource.setByteStream方法的具体用法?Java InputSource.setByteStream怎么用?Java InputSource.setByteStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.w3c.css.sac.InputSource
的用法示例。
在下文中一共展示了InputSource.setByteStream方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveNormalized
import org.w3c.css.sac.InputSource; //导入方法依赖的package包/类
@Override
public InputSource resolveNormalized(String identifier) {
String fileName = identifier;
if (!fileName.endsWith(".css")) {
fileName += ".scss";
}
try {
InputStream is = new FileInputStream(fileName);
InputSource source = new InputSource();
source.setByteStream(is);
source.setURI(fileName);
return source;
} catch (FileNotFoundException e) {
// not found, try something else
return null;
}
}
示例2: resolveNormalized
import org.w3c.css.sac.InputSource; //导入方法依赖的package包/类
@Override
public InputSource resolveNormalized(String identifier) {
String fileName = identifier;
if (!fileName.endsWith(".css")) {
fileName += ".scss";
}
// Filename should be a relative path starting with VAADIN/...
int vaadinIdx = fileName.lastIndexOf("VAADIN/");
if (vaadinIdx > -1) {
fileName = fileName.substring(vaadinIdx);
}
// Can the classloader find it?
InputStream is = getClass().getClassLoader().getResourceAsStream(
fileName);
if (is != null) {
InputSource source = new InputSource();
source.setByteStream(is);
source.setURI(fileName);
return source;
} else {
return null;
}
}
示例3: toSource
import org.w3c.css.sac.InputSource; //导入方法依赖的package包/类
private static InputSource toSource(InputStream source) {
InputSource in = new InputSource();
in.setByteStream(source);
return in;
}
示例4: parseStreamCSS
import org.w3c.css.sac.InputSource; //导入方法依赖的package包/类
private StyleSheet parseStreamCSS(InputStream inputStream) throws Exception {
StyleSheet styleSheet = new StyleSheet();
InputSource source = new InputSource();
source.setByteStream(inputStream);
//source.setURI(uri.toString());
ParserFactory factory = new ParserFactory();
parser = factory.makeParser();
docHandler = new CSSDocumentHandler(styleSheet);
parser.setDocumentHandler(docHandler);
parser.parseStyleSheet(source);
inputStream.close();
return styleSheet;
}