(
extend-protocol
BGZFIOFactory
File
(
make-bgzf-input-stream
[
^
File
x
]
(
BGZFInputStream.
x
)
)
(
make-bgzf-output-stream
[
^
File
x
]
(
BGZFOutputStream.
x
)
)
URL
(
make-bgzf-input-stream
[
^
URL
x
]
(
if
(
=
(
.getProtocol
x
)
"file"
)
(
make-bgzf-input-stream
(
cio/as-file
x
)
)
(
BGZFInputStream.
x
)
)
)
(
make-bgzf-output-stream
[
^
URL
x
]
(
if
(
=
(
.getProtocol
x
)
"file"
)
(
make-bgzf-output-stream
(
cio/as-file
x
)
)
(
throw
(
IllegalArgumentException.
(
str
"Can not write to non-file URL <"
x
">"
)
)
)
)
)
URI
(
make-bgzf-input-stream
[
^
URI
x
]
(
make-bgzf-input-stream
(
.toURL
x
)
)
)
(
make-bgzf-output-stream
[
^
URI
x
]
(
make-bgzf-output-stream
(
.toURL
x
)
)
)
String
(
make-bgzf-input-stream
[
x
]
(
try
(
make-bgzf-input-stream
(
URL.
x
)
)
(
catch
MalformedURLException
_
(
make-bgzf-input-stream
(
cio/as-file
x
)
)
)
)
)
(
make-bgzf-output-stream
[
x
]
(
try
(
make-bgzf-output-stream
(
URL.
x
)
)
(
catch
MalformedURLException
_
(
make-bgzf-output-stream
(
cio/as-file
x
)
)
)
)
)
)