Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
postprocessing
Media Converter
Commits
0387ba05
Unverified
Commit
0387ba05
authored
Sep 11, 2020
by
Sebastian Schüpbach
Browse files
fix copying of inputstream
Signed-off-by:
Sebastian Schüpbach
<
sebastian.schuepbach@unibas.ch
>
parent
2f434ee7
Pipeline
#14173
passed with stages
in 11 minutes and 57 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
k8s-manifests/test/deployment.yml
View file @
0387ba05
...
...
@@ -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-f
e
d1.memobase.unibas.ch:8080/fcrepo/rest/"
-
name
:
EXTERNAL_BASE_URL
value
:
"
https://memobase.ch/"
-
name
:
FEDORA_USER
...
...
src/main/scala/ch/memobase/FedoraClientWrapper.scala
View file @
0387ba05
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment