public CHILD_CLASS json(final Class<? extends ELEMENT_DEFS> clazz, final InputStream... inputStreams) throws SchemaException { try { return json(clazz, (Object[]) inputStreams); } finally { if (null != inputStreams) { for (final InputStream inputStream : inputStreams) { CloseableUtil.close(inputStream); } } } }
/** * Close an object. * If the object implements {@link AutoCloseable} then the object will be closed. * Any exceptions that are thrown are caught and ignored. * * @param obj the object to attempt to close */ public static void close(final Object obj) { if (obj instanceof AutoCloseable) { close((AutoCloseable) obj); } }
/** * Close a group of objects. * If an object implements {@link AutoCloseable} then the object will be closed. * Any exceptions that are thrown are caught and ignored. * * @param objs the objects to attempt to close */ public static void close(final Object... objs) { for (final Object obj : objs) { close(obj); } }
/** * Close a group of {@link AutoCloseable} objects. * Any exceptions that are thrown are caught and ignored. * * @param closeable the objects to close */ public static void close(final AutoCloseable... closeable) { for (final AutoCloseable autoCloseable : closeable) { close(autoCloseable); } }
@Override public void close() throws IOException { CloseableUtil.close(input); }
@Override public void close() { for (final Iterable<T> itr : itrs) { CloseableUtil.close(itr); } }
@Override public void close() { CloseableUtil.close(iterable); }
@Override public void close() { CloseableUtil.close(input); }
@Override public void close() { CloseableUtil.close(inputItr); }
@Override protected boolean hasSeeds() { seedSetAIter = seedSetA.iterator(); seedSetBIter = seedSetB.iterator(); final boolean hasSeeds = seedSetAIter.hasNext() && seedSetBIter.hasNext(); if (!hasSeeds) { CloseableUtil.close(seedSetAIter); CloseableUtil.close(seedSetBIter); CloseableUtil.close(operation); } return hasSeeds; }
public CHILD_CLASS json(final Class<? extends ELEMENT_DEFS> clazz, final InputStream... inputStreams) throws SchemaException { try { return json(clazz, (Object[]) inputStreams); } finally { if (null != inputStreams) { for (final InputStream inputStream : inputStreams) { CloseableUtil.close(inputStream); } } } }
@Override public void close() throws IOException { MultiEntityIdInput.super.close(); CloseableUtil.close(inputB); }
protected void addToBloomFilter(final Iterator<? extends Object> vertices, final BloomFilter filter) throws RetrieverException { try { while (vertices.hasNext()) { addToBloomFilter(vertices.next(), filter); } } finally { CloseableUtil.close(vertices); } }
protected void addToBloomFilter(final Iterator<? extends EntityId> seeds, final BloomFilter filter1, final BloomFilter filter2) throws RetrieverException { try { while (seeds.hasNext()) { addToBloomFilter(seeds.next(), filter1, filter2); } } finally { CloseableUtil.close(seeds); } }
public Builder addSchema(final InputStream schemaStream) { if (null != schemaStream) { try { addSchema(IOUtils.toByteArray(schemaStream)); } catch (final IOException e) { throw new SchemaException("Unable to read schema from input stream", e); } finally { CloseableUtil.close(schemaStream); } } return this; }