Skip to content

Commit

Permalink
Add ByteArray steroids
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacl committed Sep 23, 2017
1 parent 2a7eea1 commit 69fa197
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions modules/common/src/main/Steroids.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ trait Steroids
with DoubleSteroids
with OptionSteroids
with ListSteroids
with ByteArraySteroids

with JodaTimeSteroids

Expand Down Expand Up @@ -127,6 +128,13 @@ trait DoubleSteroids {
}
}

trait ByteArraySteroids {

implicit final class LilaPimpedByteArray(self: Array[Byte]) {
def toBase64 = java.util.Base64.getEncoder.encodeToString(self)
}
}

trait OptionSteroids {

/*
Expand Down
2 changes: 1 addition & 1 deletion modules/db/src/main/ByteArray.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import reactivemongo.bson.utils.Converters

case class ByteArray(value: Array[Byte]) extends AnyVal {

def isEmpty = value.isEmpty
def isEmpty = value.size == 0

def toHexStr = Converters hex2Str value

Expand Down

0 comments on commit 69fa197

Please sign in to comment.