Tabnine Logo
IOUtils.cleanup
Code IndexAdd Tabnine 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)

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
  • putExtra (Intent)
  • onCreateOptionsMenu (Activity)
  • getExternalFilesDir (Context)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now