mirror of
https://github.com/corda/corda.git
synced 2025-01-05 20:54:13 +00:00
Add ByteArrayOutputStream.writeTo(OutputStream), UTFDataFormatException and Modifier.isTransient(int).
This commit is contained in:
parent
ff17455baa
commit
0537cb4775
@ -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());
|
||||
|
21
classpath/java/io/UTFDataFormatException.java
Normal file
21
classpath/java/io/UTFDataFormatException.java
Normal file
@ -0,0 +1,21 @@
|
||||
/* Copyright (c) 2008-2015, Avian Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software
|
||||
for any purpose with or without fee is hereby granted, provided
|
||||
that the above copyright notice and this permission notice appear
|
||||
in all copies.
|
||||
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
package java.io;
|
||||
|
||||
public class UTFDataFormatException extends IOException {
|
||||
public UTFDataFormatException(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
public UTFDataFormatException() {
|
||||
super();
|
||||
}
|
||||
}
|
@ -32,6 +32,7 @@ public final class Modifier {
|
||||
public static boolean isProtected(int v) { return (v & PROTECTED) != 0; }
|
||||
public static boolean isStatic (int v) { return (v & STATIC) != 0; }
|
||||
public static boolean isFinal (int v) { return (v & FINAL) != 0; }
|
||||
public static boolean isTransient(int v) { return (v & TRANSIENT) != 0; }
|
||||
public static boolean isSuper (int v) { return (v & SUPER) != 0; }
|
||||
public static boolean isNative (int v) { return (v & NATIVE) != 0; }
|
||||
public static boolean isAbstract (int v) { return (v & ABSTRACT) != 0; }
|
||||
|
Loading…
Reference in New Issue
Block a user