Skip to content

Commit 24d06a0

Browse files
authored
feat(java): add ByteArray[In|out]putStream classes to io (#320)
1 parent 1ed00de commit 24d06a0

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/java/io/__init__.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
__all__ = [
1212
"BufferedReader",
1313
"BufferedWriter",
14+
"ByteArrayInputStream",
15+
"ByteArrayOutputStream",
1416
"Closeable",
1517
"DataOutputStream",
1618
"File",
@@ -96,6 +98,29 @@ def write(self, *args):
9698
pass
9799

98100

101+
class ByteArrayOutputStream(OutputStream):
102+
def __init__(self, size=0):
103+
# type: (int) -> None
104+
super(ByteArrayOutputStream, self).__init__()
105+
print(size)
106+
107+
def reset(self):
108+
# type: () -> None
109+
pass
110+
111+
def size(self):
112+
# type: () -> int
113+
pass
114+
115+
def toByteArray(self):
116+
# type: () -> bytearray
117+
pass
118+
119+
def writeTo(self, arg):
120+
# type: (Union[bytearray, OutputStream]) -> None
121+
pass
122+
123+
99124
class FileOutputStream(OutputStream):
100125
def __init__(self, *args):
101126
# type: (*Any) -> None
@@ -257,6 +282,13 @@ def transferTo(self, out):
257282
pass
258283

259284

285+
class ByteArrayInputStream(InputStream):
286+
def __init__(self, buf, offset=0, length=-1):
287+
# type: (bytearray, int, int) -> None
288+
super(ByteArrayInputStream, self).__init__()
289+
print(buf, offset, length)
290+
291+
260292
class IOException(Exception):
261293
def __init__(self, message=None, cause=None):
262294
# type: (Optional[str], Optional[Throwable]) -> None

0 commit comments

Comments
 (0)