Package ca.pgon.st.light6

Examples of ca.pgon.st.light6.StreamsUtils


    public XslTransformation usingFile(File xslFile) {
        try {
            transformer = FACTORY.newTransformer(new StreamSource(xslFile));
            return this;
        } catch (TransformerConfigurationException e) {
            throw new StLightException(e);
        }
    }
View Full Code Here


    public XslTransformation usingFile(String xslPathName) {
        try {
            transformer = FACTORY.newTransformer(new StreamSource(new File(xslPathName)));
            return this;
        } catch (TransformerConfigurationException e) {
            throw new StLightException(e);
        }
    }
View Full Code Here

    public XslTransformation usingInputStream(InputStream xslInputStream) {
        try {
            transformer = FACTORY.newTransformer(new StreamSource(xslInputStream));
            return this;
        } catch (TransformerConfigurationException e) {
            throw new StLightException(e);
        }
    }
View Full Code Here

    public XslTransformation usingReader(Reader xslReader) {
        try {
            transformer = FACTORY.newTransformer(new StreamSource(xslReader));
            return this;
        } catch (TransformerConfigurationException e) {
            throw new StLightException(e);
        }
    }
View Full Code Here

    public XslTransformation usingUrl(String xslUrl) {
        try {
            transformer = FACTORY.newTransformer(new StreamSource(xslUrl));
            return this;
        } catch (TransformerConfigurationException e) {
            throw new StLightException(e);
        }
    }
View Full Code Here

        try {
            FileOutputStream fos = new FileOutputStream(destinationFile);
            StreamsUtils.flowStream(context.getResourceAsStream(resource), fos);
            fos.close();
        } catch (Exception e) {
            throw new StLightException(e);
        }
    }
View Full Code Here

            while ((len = reader.read(chars)) != -1) {
                sb.append(chars, 0, len);
            }
            return sb.toString();
        } catch (Exception e) {
            throw new StLightException("Issue reading the stream", e);
        } finally {
            try {
                input.close();
            } catch (Exception e) {
            }
View Full Code Here

            logger.log(Level.FINE, "Copy completed");

        } catch (Exception e) {

            logger.log(Level.SEVERE, "Issue copying the stream", e);
            throw new StLightException("Issue copying the stream", e);

        } finally {

            // Close the source
            try {
View Full Code Here

     */
    public static String hashFile(File file) {
        try {
            return HashUtils.hashInputStream(ALGORITHM, new FileInputStream(file));
        } catch (FileNotFoundException e) {
            throw new StLightException(e);
        }
    }
View Full Code Here

                Queue<Bean> beans = entry.getValue();
                if (beans.isEmpty()) {
                    continue;
                }
                if (beans.size() > 1) {
                    throw new StLightException(ERROR_TOO_MANY_BEANS_OF_TYPE + type.getName());
                }
                if (response != null) {
                    throw new StLightException(ERROR_TOO_MANY_BEANS_OF_TYPE + type.getName());
                }
                response = (T) beans.peek().getBean();
            }
        }

        // Check there is one
        if (response == null) {
            throw new StLightException(ERROR_NO_BEANS_OF_TYPE + type.getName());
        }

        return response;
    }
View Full Code Here

TOP

Related Classes of ca.pgon.st.light6.StreamsUtils

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.