Examples of StringResource


Examples of org.apache.tools.ant.types.resources.StringResource

    createSignaturesFile().setFile(file);
  }
 
  /** Support for API signatures list as nested text */
  public void addText(String text) {
    addSignaturesResource(new StringResource(text));
  }
View Full Code Here

Examples of org.apache.tools.ant.types.resources.StringResource

        fakeServer = new DiscardProtocol(PORT);
        fakeServer.start();
        record = fakeServer.recordNext();
       
        stubResourceCollection = new Union();       
        stubResource = new StringResource("C: " + SCRIPT);
        stubResourceCollection.add(stubResource);
       
        subject = new MailProtocolTestTask();
        subject.setHost("127.0.0.1");
        subject.setPort(PORT);
View Full Code Here

Examples of org.apache.tools.ant.types.resources.StringResource

        super.tearDown();
        fakeServer.stop();
    }

    public void testIgnoreUnsupportedResource() throws Exception {
        final Resource unsupportedResource = new StringResource() {
            public InputStream getInputStream() {
                throw new UnsupportedOperationException();
            }
        };
        stubResourceCollection.add(unsupportedResource);
View Full Code Here

Examples of org.apache.tools.ant.types.resources.StringResource

    /**
     * Get the resources to concatenate.
     */
    private ResourceCollection getResources() {
        if (rc == null) {
            return new StringResource(getProject(), textBuffer.toString());
        }
        if (dest != null) {
            Intersect checkDestNotInSources = new Intersect();
            checkDestNotInSources.setProject(getProject());
            checkDestNotInSources.add(rc);
View Full Code Here

Examples of org.apache.tools.ant.types.resources.StringResource

     */
    public void execute() throws BuildException {
        final String msg = "".equals(message) ? StringUtils.LINE_SEP : message;
        try {
            ResourceUtils
                    .copyResource(new StringResource(msg), output == null ? new LogOutputResource(
                            this, logLevel) : output, null, null, false, false, append, null, ""
                            .equals(encoding) ? null : encoding, getProject());
        } catch (IOException ioe) {
            throw new BuildException(ioe, getLocation());
        }
View Full Code Here

Examples of org.apache.velocity.runtime.resource.util.StringResource

        if (StringUtils.isEmpty(name))
        {
            throw new ResourceNotFoundException("No template name provided");
        }

        StringResource resource = getRepository().getStringResource(name);
       
        if(resource == null)
        {
            throw new ResourceNotFoundException("Could not locate resource '" + name + "'");
        }
       
        byte [] byteArray = null;
     
        try
        {
            byteArray = resource.getBody().getBytes(resource.getEncoding());
            return new ByteArrayInputStream(byteArray);
        }
        catch(UnsupportedEncodingException ue)
        {
            throw new VelocityException("Could not convert String using encoding " + resource.getEncoding(), ue);
        }
    }
View Full Code Here

Examples of org.apache.velocity.runtime.resource.util.StringResource

    /**
     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#isSourceModified(org.apache.velocity.runtime.resource.Resource)
     */
    public boolean isSourceModified(final Resource resource)
    {
        StringResource original = null;
        boolean result = true;

        original = getRepository().getStringResource(resource.getName());

        if (original != null)
        {
            result =  original.getLastModified() != resource.getLastModified();
        }

        return result;
    }
View Full Code Here

Examples of org.apache.velocity.runtime.resource.util.StringResource

    /**
     * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#getLastModified(org.apache.velocity.runtime.resource.Resource)
     */
    public long getLastModified(final Resource resource)
    {
        StringResource original = null;

        original = getRepository().getStringResource(resource.getName());

        return (original != null)
                ? original.getLastModified()
                : 0;
    }
View Full Code Here

Examples of org.apache.velocity.runtime.resource.util.StringResource

        if (StringUtils.isEmpty(name))
        {
            throw new ResourceNotFoundException("No template name provided");
        }

        StringResource resource = this.repository.getStringResource(name);
       
        if(resource == null)
        {
            throw new ResourceNotFoundException("Could not locate resource '" + name + "'");
        }
       
        byte [] byteArray = null;
     
        try
        {
            byteArray = resource.getBody().getBytes(resource.getEncoding());
            return new ByteArrayInputStream(byteArray);
        }
        catch(UnsupportedEncodingException ue)
        {
            throw new VelocityException("Could not convert String using encoding " + resource.getEncoding(), ue);
        }
    }
View Full Code Here

Examples of org.gradle.api.internal.resource.StringResource

public class StringScriptSource implements ScriptSource {
    private final Resource resource;

    public StringScriptSource(String description, String content) {
        resource = new StringResource(description, content == null ? "" : content);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.