Skip to content

Commit

Permalink
Make internals private
Browse files Browse the repository at this point in the history
  • Loading branch information
adamw committed Feb 5, 2025
1 parent f8508c9 commit b717933
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import java.io.FilterInputStream
import java.io.InputStream
import java.io.IOException

class FailingLimitedInputStream(in: InputStream, limit: Long) extends LimitedInputStream(in, limit) {
private[client4] class FailingLimitedInputStream(in: InputStream, limit: Long) extends LimitedInputStream(in, limit) {
override def onLimit: Int = {
throw new StreamMaxLengthExceededException(limit)
}
}

/** Based on Guava's https://github.com/google/guava/blob/master/guava/src/com/google/common/io/ByteStreams.java */
class LimitedInputStream(in: InputStream, limit: Long) extends FilterInputStream(in) {
private[client4] class LimitedInputStream(in: InputStream, limit: Long) extends FilterInputStream(in) {
protected var left: Long = limit
private var mark: Long = -1L

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/sttp/client4/internal/NoStreams.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package sttp.client4.internal

import sttp.capabilities.Streams

trait NoStreams extends Streams[Nothing] {
private[client4] trait NoStreams extends Streams[Nothing] {
override type BinaryStream = Nothing
override type Pipe[A, B] = Nothing
}
object NoStreams extends NoStreams
private[client4] object NoStreams extends NoStreams
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package sttp.client4.internal

import java.io.InputStream

class OnEndInputStream(delegate: InputStream, callback: () => Unit) extends InputStream {
private[client4] class OnEndInputStream(delegate: InputStream, callback: () => Unit) extends InputStream {
private var callbackCalled = false

override def read(): Int = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package sttp.client4.internal
import sttp.client4._
import sttp.model._

object ToCurlConverter {
private[client4] object ToCurlConverter {

def apply(request: GenericRequest[_, _]): String =
apply(request, HeaderNames.SensitiveHeaders, omitAcceptEncoding = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sttp.model._

import scala.util.Random

object ToRfc2616Converter {
private[client4] object ToRfc2616Converter {

def requestToRfc2616(request: GenericRequest[_, _]): String = apply(request, HeaderNames.SensitiveHeaders)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package sttp.client4.internal

object WwwAuthHeaderParser {
private[client4] object WwwAuthHeaderParser {
def parse(text: String): WwwAuthHeaderValue =
WwwAuthHeaderValue(
text
Expand All @@ -9,7 +9,7 @@ object WwwAuthHeaderParser {
)
}

case class WwwAuthHeaderValue(values: Map[String, String]) {
private[client4] case class WwwAuthHeaderValue(values: Map[String, String]) {
val qop = values.get("qop")
val realm = values.get("realm")
val nonce = values.get("nonce")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import sttp.ws.WebSocketBufferFull

import scala.concurrent.{blocking, ExecutionContext, Future}

class FutureSimpleQueue[T](capacity: Option[Int])(implicit ec: ExecutionContext) extends SimpleQueue[Future, T] {
private[client4] class FutureSimpleQueue[T](capacity: Option[Int])(implicit ec: ExecutionContext)
extends SimpleQueue[Future, T] {

private val queue: BlockingQueue[T] = capacity match {
case Some(value) => new ArrayBlockingQueue[T](value)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package sttp.client4.internal.ws

trait SimpleQueue[F[_], T] {
private[client4] trait SimpleQueue[F[_], T] {

/** Eagerly adds the given item to the queue.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import java.util.concurrent.{ArrayBlockingQueue, BlockingQueue, LinkedBlockingQu
import sttp.shared.Identity
import sttp.ws.WebSocketBufferFull

class SyncQueue[T](capacity: Option[Int]) extends SimpleQueue[Identity, T] {
private[client4] class SyncQueue[T](capacity: Option[Int]) extends SimpleQueue[Identity, T] {

private val queue: BlockingQueue[T] = capacity match {
case Some(value) => new ArrayBlockingQueue[T](value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package sttp.client4.internal.ws

import sttp.ws.WebSocketFrame

sealed trait WebSocketEvent
object WebSocketEvent {
private[client4] sealed trait WebSocketEvent
private[client4] object WebSocketEvent {
case class Open() extends WebSocketEvent
case class Error(t: Throwable) extends WebSocketEvent
case class Frame(f: WebSocketFrame) extends WebSocketEvent
Expand Down

0 comments on commit b717933

Please sign in to comment.