Package com.sun.jersey.core.util

Examples of com.sun.jersey.core.util.Closing


                } catch (IOException ex) {
                    throw new ScannerException("IO error when scanning jar file " + child, ex);
                }
            } else if (cfl.onAccept(child.getName())) {
                try {
                    new Closing(new BufferedInputStream(new FileInputStream(child))).f(new Closing.Closure() {

                        public void f(InputStream in) throws IOException {
                            cfl.onProcess(child.getName(), in);
                        }
                    });
View Full Code Here


     * @param parent the parent path.
     * @param sl the scanning lister to report jar entries.
     * @throws IOException if an error occurred scanning the jar entries
     */
    public static void scan(final File f, final String parent, final ScannerListener sl) throws IOException {
        new Closing(new FileInputStream(f)).f(new Closing.Closure() {

            public void f(final InputStream in) throws IOException {
                scan(in, parent, sl);
            }
        });
View Full Code Here

    @Override
    public void scan(final URI u, final ScannerListener sl) throws ScannerException {
        if (sl.onAccept(u.getPath())) {
                try {
                    new Closing(new BufferedInputStream(u.toURL().openStream())).f(new Closing.Closure() {

                    @Override
                        public void f(final InputStream in) throws IOException {
                            sl.onProcess(u.getPath(), in);
                        }
View Full Code Here

     * @return a {@link Closing}.
     * @throws IOException if there is an error opening the stream.
     */
    protected Closing closing(String jarUrlString) throws IOException {
        try {
            return new Closing(new URL(jarUrlString).openStream());
        } catch (MalformedURLException ex) {
            return new Closing(new FileInputStream(
                    UriComponent.decode(jarUrlString, UriComponent.Type.PATH)));
        }
    }
View Full Code Here

        for (final File child : root.listFiles()) {
            if (child.isDirectory()) {
                scanDirectory(child, cfl);
            } else if (cfl.onAccept(child.getName())) {
                try {
                    new Closing(new BufferedInputStream(new FileInputStream(child))).f(new Closing.Closure() {

                        public void f(final InputStream in) throws IOException {
                            cfl.onProcess(child.getName(), in);
                        }
                    });
View Full Code Here

        for (final String resourcePath : resourcePaths) {
            if (resourcePath.endsWith("/")) {
                scan(resourcePath, cfl);
            } else if (resourcePath.endsWith(".jar")) {
                try {
                    new Closing(sc.getResourceAsStream(resourcePath)).f(new Closing.Closure() {
                        public void f(final InputStream in) throws IOException {
                            JarFileScanner.scan(in, "", cfl);
                        }
                    });
                } catch (IOException ex) {
                    throw new ScannerException("IO error scanning jar " + resourcePath, ex);
                }
            } else if (cfl.onAccept(resourcePath)) {
                try {
                    new Closing(sc.getResourceAsStream(resourcePath)).f(new Closing.Closure() {
                        public void f(final InputStream in) throws IOException {
                            cfl.onProcess(resourcePath, in);
                        }
                    });
                } catch (IOException ex) {
View Full Code Here

        for (final String resourcePath : resourcePaths) {
            if (resourcePath.endsWith("/")) {
                scan(resourcePath, cfl);
            } else if (resourcePath.endsWith(".jar")) {
                try {
                    new Closing(sc.getResourceAsStream(resourcePath)).f(new Closing.Closure() {
                        public void f(final InputStream in) throws IOException {
                            JarFileScanner.scan(in, "", cfl);
                        }
                    });
                } catch (IOException ex) {
                    throw new ScannerException("IO error scanning jar " + resourcePath, ex);
                }
            } else if (cfl.onAccept(resourcePath)) {
                try {
                    new Closing(sc.getResourceAsStream(resourcePath)).f(new Closing.Closure() {
                        public void f(final InputStream in) throws IOException {
                            cfl.onProcess(resourcePath, in);
                        }
                    });
                } catch (IOException ex) {
View Full Code Here

                } catch (IOException ex) {
                    throw new ScannerException("IO error when scanning jar file " + child, ex);
                }
            } else if (cfl.onAccept(child.getName())) {
                try {
                    new Closing(new BufferedInputStream(new FileInputStream(child))).f(new Closing.Closure() {

                        public void f(InputStream in) throws IOException {
                            cfl.onProcess(child.getName(), in);
                        }
                    });
View Full Code Here

    @Override
    public void scan(final URI u, final ScannerListener sl) throws ScannerException {
        if (sl.onAccept(u.getPath())) {
                try {
                    new Closing(new BufferedInputStream(u.toURL().openStream())).f(new Closing.Closure() {

                    @Override
                        public void f(final InputStream in) throws IOException {
                            sl.onProcess(u.getPath(), in);
                        }
View Full Code Here

     * @param parent the parent path.
     * @param sl the scanning lister to report jar entries.
     * @throws IOException if an error occurred scanning the jar entries
     */
    public static void scan(final File f, final String parent, final ScannerListener sl) throws IOException {
        new Closing(new FileInputStream(f)).f(new Closing.Closure() {

            public void f(final InputStream in) throws IOException {
                scan(in, parent, sl);
            }
        });
View Full Code Here

TOP

Related Classes of com.sun.jersey.core.util.Closing

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.