Unverified Commit 0387ba05 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

fix copying of inputstream


Signed-off-by: Sebastian Schüpbach's avatarSebastian Schüpbach <sebastian.schuepbach@unibas.ch>
parent 2f434ee7
Pipeline #14173 passed with stages
in 11 minutes and 57 seconds
......@@ -35,7 +35,7 @@ spec:
- name: AUDIO_SNIPPET_DURATION
value: "30"
- name: INTERNAL_BASE_URL
value: "http://mb-fd1.memobase.unibas.ch:8080/fcrepo/rest/"
value: "http://mb-fed1.memobase.unibas.ch:8080/fcrepo/rest/"
- name: EXTERNAL_BASE_URL
value: "https://memobase.ch/"
- name: FEDORA_USER
......
......@@ -36,7 +36,7 @@ import scala.util.{Failure, Success, Try}
*/
class FedoraClientWrapper(fc: FedoraClient) {
import FedoraClientWrapper.{copyDataAndCloseResource, getMediaFileType}
import FedoraClientWrapper.copyDataAndCloseResource
/**
* Fetches a binary resource from Fedora and returns, if successful, a [[ByteArrayOutputStream]] instance
......@@ -82,11 +82,9 @@ object FedoraClientWrapper {
}
private def copyDataAndCloseResource(binaryResource: BinaryResource): Try[ByteArrayOutputStream] = {
val dataByteLength = 2097152
val outputStream: Try[ByteArrayOutputStream] = Try {
val oS = new ByteArrayOutputStream()
val data = new Array[Byte](dataByteLength)
Iterator.continually(binaryResource.getData.read(data))
Iterator.continually(binaryResource.getData.read)
.takeWhile(-1 !=)
.foreach(oS.write)
oS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment