Package java.io

Examples of java.io.Closeable


                     @Override
                     public Integer get() {
                        return output.getExitStatus();
                     }

                  }, new Closeable() {

                     @Override
                     public void close() throws IOException {
                        clear();
                     }
View Full Code Here


                     public Integer get() {
                        int exitStatus = executor.getExitStatus();
                        return exitStatus != -1 ? exitStatus : null;
                     }

                  }, new Closeable() {

                     @Override
                     public void close() throws IOException {
                        clear();
                     }
View Full Code Here

       * is resolved.
       */
      TypeToken<ApiContext<? extends Closeable>> contextToken = new TypeToken<ApiContext<? extends Closeable>>() {
         private static final long serialVersionUID = 1L;
      };
      Closeable api = unwrap(contextToken).getApi();
      checkArgument(apiClass.isAssignableFrom(api.getClass()),
            "API type: %s not assignable to %s", api.getClass(), apiClass);
      return apiClass.cast(api);
   }
View Full Code Here

    }

    @Test
    public void close_success() throws Exception
    {
        Closeable c = newMock(Closeable.class);

        c.close();

        replay();

        InternalUtils.close(c);
View Full Code Here

    }

    @Test
    public void close_ignores_exceptions() throws Exception
    {
        Closeable c = newMock(Closeable.class);

        c.close();
        setThrowable(new IOException());

        replay();

        InternalUtils.close(c);
View Full Code Here

        final Source source = finder.getSource(sourceFileName);
        if (source == null) {
            throw new SourceReaderException("Could not find source file for "
                    + sourceFileName);
        }
        c.register(new Closeable() {

            @Override
            public void close() throws IOException {
                source.close();
            }
View Full Code Here

            }
        } finally {
            if (out != null)
                out.close();
            if (output instanceof Closeable) {
                Closeable closeable = (Closeable) output;
                closeable.close();
            }
        }
    }
View Full Code Here

            }
        } finally {
            if (out != null)
                out.close();
            if (output instanceof Closeable) {
                Closeable closeable = (Closeable) output;
                closeable.close();
            }
        }
    }
View Full Code Here

    }

    @Test
    public void close_success() throws Exception
    {
        Closeable c = newMock(Closeable.class);

        c.close();

        replay();

        InternalUtils.close(c);
View Full Code Here

    }

    @Test
    public void close_ignores_exceptions() throws Exception
    {
        Closeable c = newMock(Closeable.class);

        c.close();
        setThrowable(new IOException());

        replay();

        InternalUtils.close(c);
View Full Code Here

TOP

Related Classes of java.io.Closeable

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.