hex
fs2.text$.hex$
object hex
Functions for working with base 64.
Attributes
- Source:
- text.scala
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- hex.type
Members list
Concise view
Value members
Concrete methods
Converts a stream of hex text in to a stream of bytes.
Converts a stream of hex text in to a stream of bytes.
If the text is not valid hex, the pipe fails with an exception. There must be an even number of hex digits (nibbles) or the pipe fails with an exception. Whitespace characters are ignored.
The default alphabet is used by this pipe.
Attributes
- Source:
- text.scala
def :Nothing<:Any]=>F[x],Byte,Unit](((x$1:Option[Tuple2[String,Stream[F,String]]])=>x$1match{
caseSome(Tuple2(hd,tl))=>
if(augmentString(acc).size.+(augmentString(hd).size).<(2))dropPrefix(tl,acc.+(hd))else{
val`str₂`:String=acc.+(hd)
valwithoutPrefix:String=if(`str₂`.startsWith("0x").||(`str₂`.startsWith("0X")))`str₂`.substring(2)else`str₂`
go(tl.cons1[String](withoutPrefix),0,false)
}
caseNone=>
Pull.done
}))
defgo(`s₂`:Stream[F,String],`hi₂`:Int,`midByte₂`:Boolean):Pull[F,Byte,Unit]=InvariantOps[F,String](`s₂`).pull.uncons1.flatMap[F,Byte,Unit](((`x$1₂`:Option[Tuple2[String,Stream[F,String]]])=>`x$1₂`match{
caseSome(Tuple2(hd,tl))=>
val$2$:Tuple3[Chunk[Byte],Int,Boolean]=(decode1(`hd₂`,`hi₂`,`midByte₂`):@unchecked)match{
caseTuple3(out,newHi,newMidByte)=>
Tuple3.apply[Chunk[Byte],Int,Boolean](out,newHi,newMidByte)
}
val`out₂`:Chunk[Byte]=$2$._1
val`newHi₂`:Int=$2$._2
val`newMidByte₂`:Boolean=$2$._3
Pull.output[Nothing,Byte](`out₂`).>>[F,Byte,Unit](go(`tl₂`,`newHi₂`,`newMidByte₂`))
caseNone=>
if(`midByte₂`)Pull.raiseError[F](newIllegalArgumentException("Nibbleleftover"))(evidence$8)elsePull.done
}))
((`s₃`:Stream[F,String])=>StreamPullOps[F,Byte](dropPrefix(`s₃`,"")).stream)
}" t="n"class="documentableName ">decodeWithAlphabet[F[_] : RaiseThrowable](alphabet: HexAlphabet): (F, String) => Byte
Like decode
but takes a hex alphabet.
Encodes a byte stream in to a stream of hexadecimal text. The default hex alphabet is used by this pipe.
Encodes a byte stream in to a stream of hexadecimal text. The default hex alphabet is used by this pipe.
Attributes
- Source:
- text.scala
Like encode
but takes a hex alphabet.