public synchronized void close()

in google-http-client/src/main/java/com/google/api/client/util/LoggingByteArrayOutputStream.java [92:115]


  public synchronized void close() throws IOException {
    // circumvent double close
    if (!closed) {
      // log the response
      if (bytesWritten != 0) {
        // log response size
        StringBuilder buf = new StringBuilder().append("Total: ");
        LoggingByteArrayOutputStream.appendBytes(buf, bytesWritten);
        if (count != 0 && count < bytesWritten) {
          buf.append(" (logging first ");
          LoggingByteArrayOutputStream.appendBytes(buf, count);
          buf.append(")");
        }
        logger.config(buf.toString());
        // log response content
        if (count != 0) {
          // strip out some unprintable control chars
          logger.log(loggingLevel,
              toString("UTF-8").replaceAll("[\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F]", " "));
        }
      }
      closed = true;
    }
  }