mirror of
https://github.com/corda/corda.git
synced 2025-06-13 20:58:19 +00:00
Add ByteArrayOutputStream.writeTo(OutputStream), UTFDataFormatException and Modifier.isTransient(int).
This commit is contained in:
@ -98,6 +98,28 @@ public class ByteArrayOutputStream extends OutputStream {
|
||||
return array;
|
||||
}
|
||||
|
||||
public synchronized void writeTo(OutputStream out) throws IOException {
|
||||
if (length==0)
|
||||
return;
|
||||
|
||||
flushBuffer();
|
||||
|
||||
int cnt = 0;
|
||||
for (Cell c = chain; c != null; c = c.next) {
|
||||
cnt++;
|
||||
}
|
||||
|
||||
Cell[] cellArray = new Cell[cnt];
|
||||
|
||||
for (Cell c = chain; c != null; c = c.next) {
|
||||
cellArray[--cnt] = c;
|
||||
}
|
||||
|
||||
for (Cell c : cellArray){
|
||||
out.write(c.array, c.offset, c.length);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new String(toByteArray());
|
||||
|
Reference in New Issue
Block a user