Skip to content

Commit

Permalink
Update Dependencies.scala
Browse files Browse the repository at this point in the history
  • Loading branch information
StepanBrychta committed Oct 4, 2024
1 parent 18e2c5a commit 0dc1175
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ import scala.util.{Failure, Success, Try}
*/
object Unarchiver {
def open(
inputStream: InputStream
): Either[UnarchiverError, Iterator[(ArchiveEntry, InputStream)]] =
inputStream: InputStream
): Either[UnarchiverError, Iterator[(ArchiveEntry, InputStream)]] =
for {
uncompressedStream <- uncompress(inputStream)
archiveInputStream <- extract(uncompressedStream)
iterator = createIterator(archiveInputStream)
} yield iterator

private def createIterator(
archiveInputStream: ArchiveInputStream[ArchiveEntry]
): Iterator[(ArchiveEntry, InputStream)] =
archiveInputStream: ArchiveInputStream
): Iterator[(ArchiveEntry, InputStream)] =
new Iterator[(ArchiveEntry, InputStream)] {
private var latest: ArchiveEntry = _
private var seen: Set[ArchiveEntry] = Set.empty
Expand Down Expand Up @@ -84,20 +84,19 @@ object Unarchiver {
new CompressorStreamFactory()
.createCompressorInputStream(new BufferedInputStream(compressedStream))
} match {
case Success(stream) => Right(stream)
case Success(stream) => Right(stream)
case Failure(err: CompressorException) => Left(CompressorError(err))
case Failure(err) => Left(UnexpectedUnarchiverError(err))
case Failure(err) => Left(UnexpectedUnarchiverError(err))
}

private def extract(
inputStream: InputStream
): Either[UnarchiverError, ArchiveInputStream[ArchiveEntry]] =
): Either[UnarchiverError, ArchiveInputStream] =
Try {
// We have to wrap in a BufferedInputStream because this method
// only takes InputStreams that support the `mark()` method.
new ArchiveStreamFactory()
.createArchiveInputStream(new BufferedInputStream(inputStream))
.asInstanceOf[ArchiveInputStream[ArchiveEntry]]
.asInstanceOf[ArchiveInputStream]
} match {
case Success(stream) => Right(stream)
case Failure(err: ArchiveException) => Left(ArchiveFormatError(err))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ trait CompressFixture[BagLocation <: Location, Namespace]
compressorName: String
)(
outputStream: OutputStream
): CompressorOutputStream[BufferedOutputStream] = {
): CompressorOutputStream = {

val compressorStreamFactory =
new CompressorStreamFactory()
Expand All @@ -195,13 +195,13 @@ trait CompressFixture[BagLocation <: Location, Namespace]
compressorName,
bufferedOutputStream
)
}.asInstanceOf[CompressorOutputStream[BufferedOutputStream]]
}

private def packer(
archiverName: String
)(
outputStream: OutputStream
): ArchiveOutputStream[ArchiveEntry] = {
): ArchiveOutputStream = {

val archiveStreamFactory =
new ArchiveStreamFactory()
Expand Down
22 changes: 11 additions & 11 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import sbt._

object WellcomeDependencies {
lazy val versions = new {
val typesafe = "32.42.1"
val fixtures = "32.42.1"
val http = "32.42.1"
val json = "32.42.1"
val messaging = "32.42.1"
val monitoring = "32.42.1"
val storage = "32.42.1"
val elasticsearch = "32.42.1"
val sierra = "32.42.1"
val typesafe = "32.43.1"
val fixtures = "32.43.1"
val http = "32.43.1"
val json = "32.43.1"
val messaging = "32.43.1"
val monitoring = "32.43.1"
val storage = "32.43.1"
val elasticsearch = "32.43.1"
val sierra = "32.43.1"
}

val jsonLibrary: Seq[ModuleID] = Seq(
Expand Down Expand Up @@ -83,7 +83,7 @@ object ExternalDependencies {
lazy val versions = new {

val azure = "12.25.4"
val commonsCompress = "1.27.1"
val commonsCompress = "1.14"
val commonsIO = "2.17.0"
val mockito = "5.13.0"
val scalatest = "3.2.19"
Expand All @@ -96,7 +96,7 @@ object ExternalDependencies {

// This should match the version of aws used in scala-libs; see
// https://github.com/wellcomecollection/scala-libs/blob/main/project/Dependencies.scala
val aws = "2.25.28"
val aws = "2.25.70"

// These are the "Common Runtime Libraries", which you're encouraged to use for
// better performance.
Expand Down

0 comments on commit 0dc1175

Please sign in to comment.