Package org.springframework.core.io.support

Examples of org.springframework.core.io.support.EncodedResource


   * (can be empty or <code>null</code>)
   * @return the number of bean definitions found
   * @throws BeanDefinitionStoreException in case of loading or parsing errors
   */
  public int loadBeanDefinitions(Resource resource, String prefix) throws BeanDefinitionStoreException {
    return loadBeanDefinitions(new EncodedResource(resource), prefix);
  }
View Full Code Here


    }       
  }
 
  // TODO this code is duplicated from ResourceDatabasePopulator as well
  private static String readScript(Resource resource) throws IOException {
    EncodedResource encoded = resource instanceof EncodedResource ? (EncodedResource) resource : new EncodedResource(resource);
    LineNumberReader lnr = new LineNumberReader(encoded.getReader());
    String currentStatement = lnr.readLine();
    StringBuilder scriptBuilder = new StringBuilder();
    while (currentStatement != null) {
      if (StringUtils.hasText(currentStatement) && (SQL_COMMENT_PREFIX != null && !currentStatement.startsWith(SQL_COMMENT_PREFIX))) {
        if (scriptBuilder.length() > 0) {
View Full Code Here

 
  private Reader getResourceReader(Resource resource) throws IOException {
    if (resource instanceof EncodedResource) {
      return ((EncodedResource) resource).getReader();
    } else {
      return new EncodedResource(resource).getReader();
    }
  }
View Full Code Here

  private EncodedResource applyEncodingIfNecessary(Resource script) {
    if (script instanceof EncodedResource) {
      return (EncodedResource) script;
    } else {
      return new EncodedResource(script, this.sqlScriptEncoding);
    }
  }
View Full Code Here

   * Create a new ResourceScriptSource for the given resource.
   * @param resource the Resource to load the script from (using UTF-8 encoding)
   */
  public ResourceScriptSource(Resource resource) {
    Assert.notNull(resource, "Resource must not be null");
    this.resource = new EncodedResource(resource, "UTF-8");
  }
View Full Code Here

   * Set the encoding used for reading the script resource.
   * <p>The default value for regular Resources is "UTF-8".
   * A {@code null} value implies the platform default.
   */
  public void setEncoding(String encoding) {
    this.resource = new EncodedResource(this.resource.getResource(), encoding);
  }
View Full Code Here

   * @throws BeanDefinitionStoreException in case of loading or parsing errors
   * @see #loadBeanDefinitions(org.springframework.core.io.Resource, String)
   */
  @Override
  public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException {
    return loadBeanDefinitions(new EncodedResource(resource), null);
  }
View Full Code Here

   * (can be empty or {@code null})
   * @return the number of bean definitions found
   * @throws BeanDefinitionStoreException in case of loading or parsing errors
   */
  public int loadBeanDefinitions(Resource resource, String prefix) throws BeanDefinitionStoreException {
    return loadBeanDefinitions(new EncodedResource(resource), prefix);
  }
View Full Code Here

   * @return the number of bean definitions found
   * @throws BeanDefinitionStoreException in case of loading or parsing errors
   */
  @Override
  public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreException {
    return loadBeanDefinitions(new EncodedResource(resource));
  }
View Full Code Here

    sac.registerSingleton("beanThatListens", BeanThatListens.class, new MutablePropertyValues());
    sac.registerSingleton("aca", ACATester.class, new MutablePropertyValues());
    sac.registerPrototype("aca-prototype", ACATester.class, new MutablePropertyValues());
    PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(sac.getDefaultListableBeanFactory());
    Resource resource = new ClassPathResource("testBeans.properties", getClass());
    reader.loadBeanDefinitions(new EncodedResource(resource, "ISO-8859-1"));
    sac.refresh();
    sac.addApplicationListener(listener);

    sac.getStaticMessageSource().addMessage("code2", Locale.getDefault(), "message2");
View Full Code Here

TOP

Related Classes of org.springframework.core.io.support.EncodedResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.