public CSSValue parsePropertyValue(InputStream stream) throws IOException { InputSource source = new InputSource(); source.setByteStream(stream); return parsePropertyValue(source); }
@Override public InputSource resolve(String identifier) { // identifier should not have .scss, fileName should String ext = ".scss"; if (identifier.endsWith(".css")) { ext = ".css"; } String fileName = identifier; if (identifier.endsWith(ext)) { identifier = identifier.substring(0, identifier.length() - ext.length()); } else { fileName = fileName + ext; } 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; } }
public StyleSheet parseStyleSheet(InputStream stream) throws IOException { InputSource source = new InputSource(); source.setByteStream(stream); return parseStyleSheet(source); }
public CSSStyleDeclaration parseStyleDeclaration(InputStream stream) throws IOException { InputSource source = new InputSource(); source.setByteStream(stream); return parseStyleDeclaration(source); }
public SelectorList parseSelectors(InputStream stream) throws IOException { InputSource source = new InputSource(); source.setByteStream(stream); return parseSelectors(source); }
/** * Parse the supplied string into a {@link CSSStylesheet}. * @param cssString CSS container String. * @param baseURI The base URI to be used when parsing this cssString. This * URI will be used for resolving import URLs. * @param media The media list to be associated with the style rules loaded from * the CSS stream. <code>Null</code> if the rules are to be associated with * any media. * @return A CSS Stylesheet. * @throws IOException Unable to read SCC stream. * @throws CSSException Invalid CSS stream. */ public CSSStylesheet parse(String cssString, URI baseURI, SACMediaList media) throws CSSException, IOException { if(cssString == null) { throw new IllegalArgumentException("null 'cssString' arg in method call."); } if(baseURI == null) { throw new IllegalArgumentException("null 'baseURI' arg in method call."); } InputSource cssSrc = new InputSource(); cssSrc.setByteStream(new ByteArrayInputStream(cssString.getBytes())); return parse(cssSrc, baseURI, media, null); }
if (is != null) { InputSource source = new InputSource(); source.setByteStream(is); source.setURI(fileName); return source;
/** * Parse the CSS specified by the supplied cssURI arg. * @param cssURI The CSS URI. * @param media The media list to be associated with the style rules loaded from * the CSS stream. <code>Null</code> if the rules are to be associated with * any media. * @param styleSheet The {@link CSSStylesheet} to which the style rules are added. * @return A CSS Stylesheet. * @throws IOException Unable to read SCC stream. * @throws CSSException Invalid CSS stream. */ public CSSStylesheet parse(URI cssURI, SACMediaList media, CSSStylesheet styleSheet) throws CSSException, IOException { if(cssURI == null) { throw new IllegalArgumentException("null 'cssURI' arg in method call."); } InputStream cssStream = resourceLocator.getResource(cssURI.toString()); if(cssStream == null) { // Shouldn't get this - should be getting an IOException??? throw new IOException("Failed to read CSS resource: " + cssURI); } InputSource cssSrc = new InputSource(); cssSrc.setByteStream(cssStream); return parse(cssSrc, cssURI, media, styleSheet); }
source.setByteStream(new URL(source.getURI()).openStream()); } catch (Exception e) { try { source.setByteStream(new FileInputStream(source.getURI())); } catch (IOException ex) { throw new CSSException("invalid url ?"); source.setByteStream(input);
source.setByteStream( new URL( source.getURI() ).openStream() ); } catch ( Exception e ) { try { source.setByteStream( new FileInputStream( source.getURI() ) ); } catch ( IOException ex ) { throw new CSSException( "invalid url ?" ); source.setByteStream( input );
source.setByteStream(new URL(source.getURI()).openStream()); } catch (Exception e) { try { source.setByteStream(new FileInputStream(source.getURI())); } catch (IOException ex) { throw new CSSException("invalid url ?"); source.setByteStream(input);
InputSource tempStream = new InputSource(); tempStream.setURI(url.toString()); tempStream.setByteStream(stream); parseImport = true; styleSheet = (CSSStyleSheet) this.parseStyleSheet(tempStream);
stream = url.openStream(); InputSource source = new InputSource(); source.setByteStream(stream); source.setURI(url.toString()); engine.parseStyleSheet(source);
stream = url.openStream(); InputSource source = new InputSource(); source.setByteStream(stream); source.setURI(url.toString()); engine.parseStyleSheet(source);
StyleSheet parse( InputStream inputStream, String uri, ResourceLoader loader ) throws CSSException, IOException { InputSource source = new InputSource(); source.setByteStream( inputStream ); source.setEncoding( CSS_ENCODING ); source.setURI( uri ); parser.setConditionFactory( new ConditionFactoryImpl( this ) ); parser.setSelectorFactory( new SelectorFactoryImpl( this ) ); DocumentHandlerImpl documentHandler = new DocumentHandlerImpl( this, loader ); parser.setDocumentHandler( documentHandler ); parser.setErrorHandler( new ErrorHandlerImpl( this ) ); // TODO [rst] Batik parser throws ParseException try { parser.parseStyleSheet( source ); } catch( ParseException e ) { throw new CSSException( e ); } return documentHandler.getStyleSheet(); }
inputSource.setByteStream( stream ); parser.parseStyleSheet( inputSource );
inputSource.setByteStream( data.getResourceAsStream( manager ) );