kafka.utils

CoreUtils

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
Learn more about member selection
Visibility
  1. Public
  2. All

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def JSONEscapeString(s: String): String

  7. final def asInstanceOf[T0]: T0

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

    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.

  9. def clone(): AnyRef

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

    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

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

    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

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

    Create an instance of the class with the given class name

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

    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

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

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

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

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

    Returns a list of duplicated items

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

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

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

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

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

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

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

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

    Definition Classes
    Logging
  26. def finalize(): Unit

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

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

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

    Execute the given function inside the lock

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

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

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

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

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

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

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

  37. var logIdent: String

    Attributes
    protected
    Definition Classes
    Logging
  38. lazy val logger: Logger

    Definition Classes
    Logging
  39. val loggerName: String

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

    Definition Classes
    AnyRef
  41. final def notify(): Unit

    Definition Classes
    AnyRef
  42. final def notifyAll(): Unit

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

    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.

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

    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

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

    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

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

    Read a big-endian integer from a byte array

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

    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

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

    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.

  49. def rm(file: File): Unit

    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 rm(files: Seq[String]): Unit

    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

  51. def rm(file: String): Unit

    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

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

    Wrap the given function in a java.

    Wrap the given function in a java.lang.Runnable

    fun

    A function

    returns

    A Runnable that just executes the function

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

    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

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

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

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

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

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

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

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

    Definition Classes
    AnyRef
  61. def toString(): String

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

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

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

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

    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

  66. final def wait(): Unit

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

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

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

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

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

    Definition Classes
    Logging

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped