Object

kafka.utils

CoreUtils

Related Doc: package utils

Permalink

object CoreUtils extends Logging

General helper functions!

This is for general helper functions that aren't specific to Kafka logic. Things that should have been included in the standard library etc.

If you are making a new helper function and want to add it to this class please ensure the following: 1. It has documentation 2. It is the most general possible utility, not just the thing you needed in one particular place 3. You have tests for it if it is nontrivial in any way

Linear Supertypes
Logging, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. CoreUtils
  2. Logging
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def JSONEscapeString(s: String): String

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def circularIterator[T](coll: Iterable[T]): Iterator[T]

    Permalink

    Create a circular (looping) iterator over a collection.

    Create a circular (looping) iterator over a collection.

    coll

    An iterable over the underlying collection.

    returns

    A circular iterator over the collection.

  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def crc32(bytes: Array[Byte], offset: Int, size: Int): Long

    Permalink

    Compute the CRC32 of the segment of the byte array given by the specificed size and offset

    Compute the CRC32 of the segment of the byte array given by the specificed size and offset

    bytes

    The bytes to checksum

    offset

    the offset at which to begin checksumming

    size

    the number of bytes to checksum

    returns

    The CRC32

  9. def crc32(bytes: Array[Byte]): Long

    Permalink

    Compute the CRC32 of the byte array

    Compute the CRC32 of the byte array

    bytes

    The array to compute the checksum for

    returns

    The CRC32

  10. def createObject[T <: AnyRef](className: String, args: AnyRef*): T

    Permalink

    Create an instance of the class with the given class name

  11. def daemonThread(name: String, fun: ⇒ Unit): Thread

    Permalink

    Create a daemon thread

    Create a daemon thread

    name

    The name of the thread

    fun

    The runction to execute in the thread

    returns

    The unstarted thread

  12. def debug(msg: ⇒ String, e: ⇒ Throwable): Unit

    Permalink
    Definition Classes
    Logging
  13. def debug(e: ⇒ Throwable): Any

    Permalink
    Definition Classes
    Logging
  14. def debug(msg: ⇒ String): Unit

    Permalink
    Definition Classes
    Logging
  15. def duplicates[T](s: Traversable[T]): Iterable[T]

    Permalink

    Returns a list of duplicated items

  16. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  18. def error(msg: ⇒ String, e: ⇒ Throwable): Unit

    Permalink
    Definition Classes
    Logging
  19. def error(e: ⇒ Throwable): Any

    Permalink
    Definition Classes
    Logging
  20. def error(msg: ⇒ String): Unit

    Permalink
    Definition Classes
    Logging
  21. def fatal(msg: ⇒ String, e: ⇒ Throwable): Unit

    Permalink
    Definition Classes
    Logging
  22. def fatal(e: ⇒ Throwable): Any

    Permalink
    Definition Classes
    Logging
  23. def fatal(msg: ⇒ String): Unit

    Permalink
    Definition Classes
    Logging
  24. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  25. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  26. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  27. def inLock[T](lock: Lock)(fun: ⇒ T): T

    Permalink

    Execute the given function inside the lock

  28. def inReadLock[T](lock: ReadWriteLock)(fun: ⇒ T): T

    Permalink
  29. def inWriteLock[T](lock: ReadWriteLock)(fun: ⇒ T): T

    Permalink
  30. def info(msg: ⇒ String, e: ⇒ Throwable): Unit

    Permalink
    Definition Classes
    Logging
  31. def info(e: ⇒ Throwable): Any

    Permalink
    Definition Classes
    Logging
  32. def info(msg: ⇒ String): Unit

    Permalink
    Definition Classes
    Logging
  33. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  34. def listenerListToEndPoints(listeners: String): Map[SecurityProtocol, EndPoint]

    Permalink
  35. var logIdent: String

    Permalink
    Attributes
    protected
    Definition Classes
    Logging
  36. lazy val logger: Logger

    Permalink
    Definition Classes
    Logging
  37. val loggerName: String

    Permalink
    Definition Classes
    Logging
  38. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  39. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  40. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  41. def parseCsvList(csvList: String): Seq[String]

    Permalink

    Parse a comma separated string into a sequence of strings.

    Parse a comma separated string into a sequence of strings. Whitespace surrounding the comma will be removed.

  42. def parseCsvMap(str: String): Map[String, String]

    Permalink

    This method gets comma separated values which contains key,value pairs and returns a map of key value pairs.

    This method gets comma separated values which contains key,value pairs and returns a map of key value pairs. the format of allCSVal is key1:val1, key2:val2 .... Also supports strings with multiple ":" such as IpV6 addresses, taking the last occurrence of the ":" in the pair as the split, eg a:b:c:val1, d:e:f:val2 => a:b:c -> val1, d:e:f -> val2

  43. def read(channel: ReadableByteChannel, buffer: ByteBuffer): Int

    Permalink

    Read some bytes into the provided buffer, and return the number of bytes read.

    Read some bytes into the provided buffer, and return the number of bytes read. If the channel has been closed or we get -1 on the read for any reason, throw an EOFException

  44. def readInt(bytes: Array[Byte], offset: Int): Int

    Permalink

    Read a big-endian integer from a byte array

  45. def registerMBean(mbean: AnyRef, name: String): Boolean

    Permalink

    Register the given mbean with the platform mbean server, unregistering any mbean that was there before.

    Register the given mbean with the platform mbean server, unregistering any mbean that was there before. Note, this method will not throw an exception if the registration fails (since there is nothing you can do and it isn't fatal), instead it just returns false indicating the registration failed.

    mbean

    The object to register as an mbean

    name

    The name to register this mbean with

    returns

    true if the registration succeeded

  46. def replaceSuffix(s: String, oldSuffix: String, newSuffix: String): String

    Permalink

    Replace the given string suffix with the new suffix.

    Replace the given string suffix with the new suffix. If the string doesn't end with the given suffix throw an exception.

  47. def rm(file: File): Unit

    Permalink

    Recursively delete the given file/directory and any subfiles (if any exist)

    Recursively delete the given file/directory and any subfiles (if any exist)

    file

    The root file at which to begin deleting

  48. def rm(files: Seq[String]): Unit

    Permalink

    Recursively delete the list of files/directories and any subfiles (if any exist)

    Recursively delete the list of files/directories and any subfiles (if any exist)

    files

    sequence of files to be deleted

  49. def rm(file: String): Unit

    Permalink

    Recursively delete the given file/directory and any subfiles (if any exist)

    Recursively delete the given file/directory and any subfiles (if any exist)

    file

    The root file at which to begin deleting

  50. def runnable(fun: ⇒ Unit): Runnable

    Permalink

    Wrap the given function in a java.lang.Runnable

    Wrap the given function in a java.lang.Runnable

    fun

    A function

    returns

    A Runnable that just executes the function

  51. def swallow(log: (AnyRef, Throwable) ⇒ Unit, action: ⇒ Unit): Unit

    Permalink

    Do the given action and log any exceptions thrown without rethrowing them

    Do the given action and log any exceptions thrown without rethrowing them

    log

    The log method to use for logging. E.g. logger.warn

    action

    The action to execute

  52. def swallow(action: ⇒ Unit): Unit

    Permalink
    Definition Classes
    Logging
  53. def swallowDebug(action: ⇒ Unit): Unit

    Permalink
    Definition Classes
    Logging
  54. def swallowError(action: ⇒ Unit): Unit

    Permalink
    Definition Classes
    Logging
  55. def swallowInfo(action: ⇒ Unit): Unit

    Permalink
    Definition Classes
    Logging
  56. def swallowTrace(action: ⇒ Unit): Unit

    Permalink
    Definition Classes
    Logging
  57. def swallowWarn(action: ⇒ Unit): Unit

    Permalink
    Definition Classes
    Logging
  58. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  59. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  60. def trace(msg: ⇒ String, e: ⇒ Throwable): Unit

    Permalink
    Definition Classes
    Logging
  61. def trace(e: ⇒ Throwable): Any

    Permalink
    Definition Classes
    Logging
  62. def trace(msg: ⇒ String): Unit

    Permalink
    Definition Classes
    Logging
  63. def unregisterMBean(name: String): Unit

    Permalink

    Unregister the mbean with the given name, if there is one registered

    Unregister the mbean with the given name, if there is one registered

    name

    The mbean name to unregister

  64. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  65. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  66. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  67. def warn(msg: ⇒ String, e: ⇒ Throwable): Unit

    Permalink
    Definition Classes
    Logging
  68. def warn(e: ⇒ Throwable): Any

    Permalink
    Definition Classes
    Logging
  69. def warn(msg: ⇒ String): Unit

    Permalink
    Definition Classes
    Logging

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped