summaryrefslogtreecommitdiff
path: root/pyasn1/codec/ber/decoder.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyasn1/codec/ber/decoder.py')
-rw-r--r--pyasn1/codec/ber/decoder.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/pyasn1/codec/ber/decoder.py b/pyasn1/codec/ber/decoder.py
index bbca7f5..62f5616 100644
--- a/pyasn1/codec/ber/decoder.py
+++ b/pyasn1/codec/ber/decoder.py
@@ -46,13 +46,13 @@ def asSeekableStream(substrate):
try:
if _PY2 and isinstance(substrate, file):
return BytesIO(substrate.read()) # Not optimal for really large files
- elif not substrate.seekable():
- return BufferedReader(substrate, _BUFFER_SIZE)
- else:
+ elif substrate.seekable():
return substrate
+ else:
+ # TODO: Implement for non-seekable streams
+ raise NotImplementedError("Cannot use non-seekable bit stream: " + substrate.__class__.__name__)
except AttributeError as f:
- print(f)
- raise TypeError("Cannot convert " + substrate.__class__.__name__ + " to seekable bit stream.")
+ raise TypeError("Cannot convert " + substrate.__class__.__name__ + " to a seekable bit stream.")
def endOfStream(substrate):