Codota Logo
IOUtils.cleanup
Code IndexAdd Codota to your IDE (free)

How to use
cleanup
method
in
org.apache.zookeeper.common.IOUtils

Best Java code snippets using org.apache.zookeeper.common.IOUtils.cleanup (Showing top 3 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: apache/zookeeper

/**
 * Closes the stream ignoring {@link IOException}. Must only be called in
 * cleaning up from exception handlers.
 * 
 * @param stream
 *            the Stream to close
 */
public static void closeStream(Closeable stream) {
  cleanup(null, stream);
}
origin: org.apache.zookeeper/zookeeper

/**
 * Closes the stream ignoring {@link IOException}. Must only be called in
 * cleaning up from exception handlers.
 * 
 * @param stream
 *            the Stream to close
 */
public static void closeStream(Closeable stream) {
  cleanup(null, stream);
}
origin: apache/zookeeper

  public static byte[] serializeRequest(Request request) {
    if (request == null || request.getHdr() == null) return null;
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    BinaryOutputArchive boa = BinaryOutputArchive.getArchive(baos);
    try {
      request.getHdr().serialize(boa, "hdr");
      if (request.getTxn() != null) {
        request.getTxn().serialize(boa, "txn");
      }
    } catch (IOException e) {
      LOG.error("This really should be impossible", e);
    } finally {
      IOUtils.cleanup(LOG, baos);
    }
    return baos.toByteArray();
  }
}
org.apache.zookeeper.commonIOUtilscleanup

Javadoc

Close the Closeable objects and ignore any IOException or null pointers. Must only be used for cleanup in exception handlers.

Popular methods of IOUtils

  • closeStream
    Closes the stream ignoring IOException. Must only be called in cleaning up from exception handlers.
  • copyBytes
    Copies from one stream to another.

Popular in Java

  • Reactive rest calls using spring rest template
  • findViewById (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • notifyDataSetChanged (ArrayAdapter)
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • PrintWriter (java.io)
    Prints formatted representations of objects to a text-output stream. This class implements all of th
  • String (java.lang)
  • SortedSet (java.util)
    A Set that further provides a total ordering on its elements. The elements are ordered using their C
  • JList (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now