!ht* #17279 scala side: refactor package structure to new layout

This commit is contained in:
Mathias 2015-04-24 16:33:46 +02:00
parent 29063bce86
commit 10c8cf230e
3 changed files with 18 additions and 9 deletions

View file

@ -121,6 +121,15 @@ package object util {
private[this] val _identityFunc: Any Any = x x
/** Returns a constant identity function to avoid allocating the closure */
private[http] def identityFunc[T]: T T = _identityFunc.asInstanceOf[T T]
private[http] def humanReadableByteCount(bytes: Long, si: Boolean): String = {
val unit = if (si) 1000 else 1024
if (bytes >= unit) {
val exp = (math.log(bytes) / math.log(unit)).toInt
val pre = if (si) "kMGTPE".charAt(exp - 1).toString else "KMGTPE".charAt(exp - 1).toString + 'i'
"%.1f %sB" format (bytes / math.pow(unit, exp), pre)
} else bytes.toString + " B"
}
}
package util {

View file

@ -2,15 +2,15 @@
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.marshallers.sprayjson
package akka.http.scaladsl.marshallers.sprayjson
import scala.language.implicitConversions
import scala.concurrent.ExecutionContext
import akka.stream.FlowMaterializer
import akka.http.marshalling.{ ToEntityMarshaller, Marshaller }
import akka.http.unmarshalling.{ FromEntityUnmarshaller, Unmarshaller }
import akka.http.model.{ ContentTypes, HttpCharsets }
import akka.http.model.MediaTypes.`application/json`
import akka.http.scaladsl.marshalling.{ ToEntityMarshaller, Marshaller }
import akka.http.scaladsl.unmarshalling.{ FromEntityUnmarshaller, Unmarshaller }
import akka.http.scaladsl.model.{ ContentTypes, HttpCharsets }
import akka.http.scaladsl.model.MediaTypes.`application/json`
import spray.json._
/**

View file

@ -2,16 +2,16 @@
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
*/
package akka.http.marshallers.xml
package akka.http.scaladsl.marshallers.xml
import java.io.{ ByteArrayInputStream, InputStreamReader }
import scala.collection.immutable
import scala.concurrent.ExecutionContext
import scala.xml.{ XML, NodeSeq }
import akka.stream.FlowMaterializer
import akka.http.unmarshalling._
import akka.http.marshalling._
import akka.http.model._
import akka.http.scaladsl.unmarshalling._
import akka.http.scaladsl.marshalling._
import akka.http.scaladsl.model._
import MediaTypes._
trait ScalaXmlSupport {