mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Reduce unnecessary usages of T-prefixed classes in classlib
This commit is contained in:
parent
6790d724c7
commit
1214534671
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TBufferedInputStream extends TFilterInputStream {
|
||||
protected volatile byte[] buf;
|
||||
|
@ -38,16 +38,16 @@ public class TBufferedInputStream extends TFilterInputStream {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int available() throws TIOException {
|
||||
public int available() throws IOException {
|
||||
TInputStream localIn = in;
|
||||
if (buf == null || localIn == null) {
|
||||
throw new TIOException(TString.wrap("Stream is closed"));
|
||||
throw new IOException("Stream is closed");
|
||||
}
|
||||
return count - pos + localIn.available();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws TIOException {
|
||||
public void close() throws IOException {
|
||||
buf = null;
|
||||
TInputStream localIn = in;
|
||||
in = null;
|
||||
|
@ -56,7 +56,7 @@ public class TBufferedInputStream extends TFilterInputStream {
|
|||
}
|
||||
}
|
||||
|
||||
private int fillbuf(TInputStream localIn, byte[] localBuf) throws TIOException {
|
||||
private int fillbuf(TInputStream localIn, byte[] localBuf) throws IOException {
|
||||
if (markpos == -1 || (pos - markpos >= marklimit)) {
|
||||
/* Mark position not set or exceeded readlimit */
|
||||
int result = localIn.read(localBuf);
|
||||
|
@ -103,13 +103,13 @@ public class TBufferedInputStream extends TFilterInputStream {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized int read() throws TIOException {
|
||||
public synchronized int read() throws IOException {
|
||||
// Use local refs since buf and in may be invalidated by an
|
||||
// unsynchronized close()
|
||||
byte[] localBuf = buf;
|
||||
TInputStream localIn = in;
|
||||
if (localBuf == null || localIn == null) {
|
||||
throw new TIOException(TString.wrap("Stream is closed"));
|
||||
throw new IOException("Stream is closed");
|
||||
}
|
||||
|
||||
/* Are there buffered bytes available? */
|
||||
|
@ -120,7 +120,7 @@ public class TBufferedInputStream extends TFilterInputStream {
|
|||
if (localBuf != buf) {
|
||||
localBuf = buf;
|
||||
if (localBuf == null) {
|
||||
throw new TIOException(TString.wrap("Stream is closed"));
|
||||
throw new IOException("Stream is closed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,10 +132,10 @@ public class TBufferedInputStream extends TFilterInputStream {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized int read(byte[] buffer, int offset, int length) throws TIOException {
|
||||
public synchronized int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
byte[] localBuf = buf;
|
||||
if (localBuf == null) {
|
||||
throw new TIOException(TString.wrap("Stream is closed"));
|
||||
throw new IOException("Stream is closed");
|
||||
}
|
||||
// avoid int overflow
|
||||
if (offset > buffer.length - length || offset < 0 || length < 0) {
|
||||
|
@ -146,7 +146,7 @@ public class TBufferedInputStream extends TFilterInputStream {
|
|||
}
|
||||
TInputStream localIn = in;
|
||||
if (localIn == null) {
|
||||
throw new TIOException(TString.wrap("Stream is closed"));
|
||||
throw new IOException("Stream is closed");
|
||||
}
|
||||
|
||||
int required;
|
||||
|
@ -183,7 +183,7 @@ public class TBufferedInputStream extends TFilterInputStream {
|
|||
if (localBuf != buf) {
|
||||
localBuf = buf;
|
||||
if (localBuf == null) {
|
||||
throw new TIOException(TString.wrap("Stream is closed"));
|
||||
throw new IOException("Stream is closed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,30 +203,30 @@ public class TBufferedInputStream extends TFilterInputStream {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized void reset() throws TIOException {
|
||||
public synchronized void reset() throws IOException {
|
||||
if (buf == null) {
|
||||
throw new TIOException(TString.wrap("Stream is closed"));
|
||||
throw new IOException("Stream is closed");
|
||||
}
|
||||
if (-1 == markpos) {
|
||||
throw new TIOException(TString.wrap("Mark has been invalidated."));
|
||||
throw new IOException("Mark has been invalidated.");
|
||||
}
|
||||
pos = markpos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized long skip(long amount) throws TIOException {
|
||||
public synchronized long skip(long amount) throws IOException {
|
||||
// Use local refs since buf and in may be invalidated by an
|
||||
// unsynchronized close()
|
||||
byte[] localBuf = buf;
|
||||
TInputStream localIn = in;
|
||||
if (localBuf == null) {
|
||||
throw new TIOException(TString.wrap("Stream is closed"));
|
||||
throw new IOException("Stream is closed");
|
||||
}
|
||||
if (amount < 1) {
|
||||
return 0;
|
||||
}
|
||||
if (localIn == null) {
|
||||
throw new TIOException(TString.wrap("Stream is closed"));
|
||||
throw new IOException("Stream is closed");
|
||||
}
|
||||
|
||||
if (count - pos >= amount) {
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TBufferedOutputStream extends TFilterOutputStream {
|
||||
protected byte[] buf;
|
||||
protected int count;
|
||||
|
@ -34,13 +36,13 @@ public class TBufferedOutputStream extends TFilterOutputStream {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws TIOException {
|
||||
public void flush() throws IOException {
|
||||
flushInternal();
|
||||
out.flush();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] buffer, int offset, int length) throws TIOException {
|
||||
public void write(byte[] buffer, int offset, int length) throws IOException {
|
||||
byte[] internalBuffer = buf;
|
||||
|
||||
if (internalBuffer != null && length >= internalBuffer.length) {
|
||||
|
@ -62,7 +64,7 @@ public class TBufferedOutputStream extends TFilterOutputStream {
|
|||
}
|
||||
|
||||
if (internalBuffer == null) {
|
||||
throw new TIOException();
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
// flush the internal buffer first if we have not enough space left
|
||||
|
@ -76,7 +78,7 @@ public class TBufferedOutputStream extends TFilterOutputStream {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void close() throws TIOException {
|
||||
public void close() throws IOException {
|
||||
if (buf == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -89,10 +91,10 @@ public class TBufferedOutputStream extends TFilterOutputStream {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void write(int oneByte) throws TIOException {
|
||||
public void write(int oneByte) throws IOException {
|
||||
byte[] internalBuffer = buf;
|
||||
if (internalBuffer == null) {
|
||||
throw new TIOException();
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
if (count == internalBuffer.length) {
|
||||
|
@ -102,7 +104,7 @@ public class TBufferedOutputStream extends TFilterOutputStream {
|
|||
internalBuffer[count++] = (byte) oneByte;
|
||||
}
|
||||
|
||||
private void flushInternal() throws TIOException {
|
||||
private void flushInternal() throws IOException {
|
||||
if (count > 0) {
|
||||
out.write(buf, 0, count);
|
||||
count = 0;
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.lang.TIllegalArgumentException;
|
||||
import org.teavm.classlib.java.lang.TMath;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import org.teavm.classlib.java.lang.TStringBuilder;
|
||||
import org.teavm.classlib.java.util.TArrays;
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class TBufferedReader extends TReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int read() throws TIOException {
|
||||
public int read() throws IOException {
|
||||
requireOpened();
|
||||
if (index >= count) {
|
||||
if (!fillBuffer(0)) {
|
||||
|
@ -53,14 +53,14 @@ public class TBufferedReader extends TReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void close() throws TIOException {
|
||||
public void close() throws IOException {
|
||||
requireOpened();
|
||||
innerReader.close();
|
||||
innerReader = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(char[] cbuf, int off, int len) throws TIOException {
|
||||
public int read(char[] cbuf, int off, int len) throws IOException {
|
||||
requireOpened();
|
||||
if (index == count && eof) {
|
||||
return -1;
|
||||
|
@ -79,7 +79,7 @@ public class TBufferedReader extends TReader {
|
|||
return charsRead;
|
||||
}
|
||||
|
||||
public TString readLine() throws TIOException {
|
||||
public String readLine() throws IOException {
|
||||
requireOpened();
|
||||
if (eof && index >= count) {
|
||||
return null;
|
||||
|
@ -108,11 +108,11 @@ public class TBufferedReader extends TReader {
|
|||
line.append(ch);
|
||||
}
|
||||
}
|
||||
return TString.wrap(line.toString());
|
||||
return line.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long skip(long n) throws TIOException {
|
||||
public long skip(long n) throws IOException {
|
||||
requireOpened();
|
||||
if (n < count - index) {
|
||||
index += n;
|
||||
|
@ -135,7 +135,7 @@ public class TBufferedReader extends TReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void mark(int readAheadLimit) throws TIOException {
|
||||
public void mark(int readAheadLimit) throws IOException {
|
||||
if (readAheadLimit > buffer.length) {
|
||||
buffer = TArrays.copyOf(buffer, readAheadLimit);
|
||||
}
|
||||
|
@ -149,14 +149,14 @@ public class TBufferedReader extends TReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void reset() throws TIOException {
|
||||
public void reset() throws IOException {
|
||||
if (mark == -1) {
|
||||
throw new TIOException();
|
||||
throw new IOException();
|
||||
}
|
||||
index = mark;
|
||||
}
|
||||
|
||||
private boolean fillBuffer(int offset) throws TIOException {
|
||||
private boolean fillBuffer(int offset) throws IOException {
|
||||
if (eof) {
|
||||
return false;
|
||||
}
|
||||
|
@ -177,9 +177,9 @@ public class TBufferedReader extends TReader {
|
|||
return true;
|
||||
}
|
||||
|
||||
private void requireOpened() {
|
||||
private void requireOpened() throws IOException {
|
||||
if (innerReader == null) {
|
||||
throw new TIOException();
|
||||
throw new IOException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.lang.TMath;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import org.teavm.classlib.java.util.TArrays;
|
||||
|
@ -65,7 +66,7 @@ public class TByteArrayOutputStream extends TOutputStream {
|
|||
return new TString(buf, 0, count, charsetName);
|
||||
}
|
||||
|
||||
public void writeTo(TOutputStream out) throws TIOException {
|
||||
public void writeTo(TOutputStream out) throws IOException {
|
||||
out.write(buf, 0, count);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.lang.TAutoCloseable;
|
||||
|
||||
public interface TCloseable extends TAutoCloseable {
|
||||
@Override
|
||||
void close() throws TIOException;
|
||||
void close() throws IOException;
|
||||
}
|
||||
|
|
|
@ -15,36 +15,36 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import java.io.IOException;
|
||||
|
||||
public interface TDataInput {
|
||||
void readFully(byte[] b) throws TIOException;
|
||||
void readFully(byte[] b) throws IOException;
|
||||
|
||||
void readFully(byte[] b, int off, int len) throws TIOException;
|
||||
void readFully(byte[] b, int off, int len) throws IOException;
|
||||
|
||||
int skipBytes(int n) throws TIOException;
|
||||
int skipBytes(int n) throws IOException;
|
||||
|
||||
boolean readBoolean() throws TIOException;
|
||||
boolean readBoolean() throws IOException;
|
||||
|
||||
byte readByte() throws TIOException;
|
||||
byte readByte() throws IOException;
|
||||
|
||||
int readUnsignedByte() throws TIOException;
|
||||
int readUnsignedByte() throws IOException;
|
||||
|
||||
short readShort() throws TIOException;
|
||||
short readShort() throws IOException;
|
||||
|
||||
int readUnsignedShort() throws TIOException;
|
||||
int readUnsignedShort() throws IOException;
|
||||
|
||||
char readChar() throws TIOException;
|
||||
char readChar() throws IOException;
|
||||
|
||||
int readInt() throws TIOException;
|
||||
int readInt() throws IOException;
|
||||
|
||||
long readLong() throws TIOException;
|
||||
long readLong() throws IOException;
|
||||
|
||||
float readFloat() throws TIOException;
|
||||
float readFloat() throws IOException;
|
||||
|
||||
double readDouble() throws TIOException;
|
||||
double readDouble() throws IOException;
|
||||
|
||||
TString readLine() throws TIOException;
|
||||
String readLine() throws IOException;
|
||||
|
||||
TString readUTF() throws TIOException;
|
||||
String readUTF() throws IOException;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.lang.*;
|
||||
|
||||
public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
||||
|
@ -26,17 +27,17 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final int read(byte[] buffer) throws TIOException {
|
||||
public final int read(byte[] buffer) throws IOException {
|
||||
return in.read(buffer, 0, buffer.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int read(byte[] buffer, int offset, int length) throws TIOException {
|
||||
public final int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
return in.read(buffer, offset, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean readBoolean() throws TIOException {
|
||||
public final boolean readBoolean() throws IOException {
|
||||
int temp = in.read();
|
||||
if (temp < 0) {
|
||||
throw new TEOFException();
|
||||
|
@ -45,7 +46,7 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final byte readByte() throws TIOException {
|
||||
public final byte readByte() throws IOException {
|
||||
int temp = in.read();
|
||||
if (temp < 0) {
|
||||
throw new TEOFException();
|
||||
|
@ -53,7 +54,7 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
return (byte) temp;
|
||||
}
|
||||
|
||||
private int readToBuff(int count) throws TIOException {
|
||||
private int readToBuff(int count) throws IOException {
|
||||
int offset = 0;
|
||||
while (offset < count) {
|
||||
int bytesRead = in.read(buff, offset, count - offset);
|
||||
|
@ -66,7 +67,7 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final char readChar() throws TIOException {
|
||||
public final char readChar() throws IOException {
|
||||
if (readToBuff(2) < 0) {
|
||||
throw new TEOFException();
|
||||
}
|
||||
|
@ -74,22 +75,22 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final double readDouble() throws TIOException {
|
||||
public final double readDouble() throws IOException {
|
||||
return TDouble.longBitsToDouble(readLong());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final float readFloat() throws TIOException {
|
||||
public final float readFloat() throws IOException {
|
||||
return TFloat.intBitsToFloat(readInt());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void readFully(byte[] buffer) throws TIOException {
|
||||
public final void readFully(byte[] buffer) throws IOException {
|
||||
readFully(buffer, 0, buffer.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void readFully(byte[] buffer, int offset, int length) throws TIOException {
|
||||
public final void readFully(byte[] buffer, int offset, int length) throws IOException {
|
||||
if (length < 0) {
|
||||
throw new TIndexOutOfBoundsException();
|
||||
}
|
||||
|
@ -116,7 +117,7 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final int readInt() throws TIOException {
|
||||
public final int readInt() throws IOException {
|
||||
if (readToBuff(4) < 0) {
|
||||
throw new TEOFException();
|
||||
}
|
||||
|
@ -125,7 +126,7 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
|
||||
@Override
|
||||
@Deprecated
|
||||
public final TString readLine() throws TIOException {
|
||||
public final String readLine() throws IOException {
|
||||
TStringBuilder line = new TStringBuilder(80);
|
||||
boolean foundTerminator = false;
|
||||
while (true) {
|
||||
|
@ -135,11 +136,11 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
if (line.length() == 0 && !foundTerminator) {
|
||||
return null;
|
||||
}
|
||||
return TString.wrap(line.toString());
|
||||
return line.toString();
|
||||
case (byte) '\r':
|
||||
if (foundTerminator) {
|
||||
((TPushbackInputStream) in).unread(nextByte);
|
||||
return TString.wrap(line.toString());
|
||||
return line.toString();
|
||||
}
|
||||
foundTerminator = true;
|
||||
/* Have to be able to peek ahead one byte */
|
||||
|
@ -148,11 +149,11 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
}
|
||||
break;
|
||||
case (byte) '\n':
|
||||
return TString.wrap(line.toString());
|
||||
return line.toString();
|
||||
default:
|
||||
if (foundTerminator) {
|
||||
((TPushbackInputStream) in).unread(nextByte);
|
||||
return TString.wrap(line.toString());
|
||||
return line.toString();
|
||||
}
|
||||
line.append((char) nextByte);
|
||||
}
|
||||
|
@ -160,7 +161,7 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final long readLong() throws TIOException {
|
||||
public final long readLong() throws IOException {
|
||||
if (readToBuff(8) < 0) {
|
||||
throw new TEOFException();
|
||||
}
|
||||
|
@ -172,7 +173,7 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final short readShort() throws TIOException {
|
||||
public final short readShort() throws IOException {
|
||||
if (readToBuff(2) < 0) {
|
||||
throw new TEOFException();
|
||||
}
|
||||
|
@ -180,7 +181,7 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final int readUnsignedByte() throws TIOException {
|
||||
public final int readUnsignedByte() throws IOException {
|
||||
int temp = in.read();
|
||||
if (temp < 0) {
|
||||
throw new TEOFException();
|
||||
|
@ -189,7 +190,7 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final int readUnsignedShort() throws TIOException {
|
||||
public final int readUnsignedShort() throws IOException {
|
||||
if (readToBuff(2) < 0) {
|
||||
throw new TEOFException();
|
||||
}
|
||||
|
@ -197,15 +198,15 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
}
|
||||
|
||||
@Override
|
||||
public final TString readUTF() throws TIOException {
|
||||
public final String readUTF() throws IOException {
|
||||
return decodeUTF(readUnsignedShort());
|
||||
}
|
||||
|
||||
TString decodeUTF(int utfSize) throws TIOException {
|
||||
String decodeUTF(int utfSize) throws IOException {
|
||||
return decodeUTF(utfSize, this);
|
||||
}
|
||||
|
||||
private static TString decodeUTF(int utfSize, TDataInput in) throws TIOException {
|
||||
private static String decodeUTF(int utfSize, TDataInput in) throws IOException {
|
||||
byte[] buf = new byte[utfSize];
|
||||
char[] out = new char[utfSize];
|
||||
in.readFully(buf, 0, utfSize);
|
||||
|
@ -213,12 +214,12 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
return convertUTF8WithBuf(buf, out, 0, utfSize);
|
||||
}
|
||||
|
||||
public static final TString readUTF(TDataInput in) throws TIOException {
|
||||
public static String readUTF(TDataInput in) throws IOException {
|
||||
return decodeUTF(in.readUnsignedShort(), in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int skipBytes(int count) throws TIOException {
|
||||
public final int skipBytes(int count) throws IOException {
|
||||
int skipped = 0;
|
||||
|
||||
while (skipped < count) {
|
||||
|
@ -234,7 +235,7 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
return skipped;
|
||||
}
|
||||
|
||||
private static TString convertUTF8WithBuf(byte[] buf, char[] out, int offset, int utfSize)
|
||||
private static String convertUTF8WithBuf(byte[] buf, char[] out, int offset, int utfSize)
|
||||
throws TUTFDataFormatException {
|
||||
int count = 0;
|
||||
int s = 0;
|
||||
|
@ -247,27 +248,27 @@ public class TDataInputStream extends TFilterInputStream implements TDataInput {
|
|||
s++;
|
||||
} else if ((a & 0xe0) == 0xc0) {
|
||||
if (count >= utfSize) {
|
||||
throw new TUTFDataFormatException(TString.wrap("End of stream reached"));
|
||||
throw new TUTFDataFormatException("End of stream reached");
|
||||
}
|
||||
int b = buf[offset + count++];
|
||||
if ((b & 0xC0) != 0x80) {
|
||||
throw new TUTFDataFormatException(TString.wrap("Malformed UTF-8 sequence"));
|
||||
throw new TUTFDataFormatException("Malformed UTF-8 sequence");
|
||||
}
|
||||
out[s++] = (char) (((a & 0x1F) << 6) | (b & 0x3F));
|
||||
} else if ((a & 0xf0) == 0xe0) {
|
||||
if (count + 1 >= utfSize) {
|
||||
throw new TUTFDataFormatException(TString.wrap("Malformed UTF-8 sequence"));
|
||||
throw new TUTFDataFormatException("Malformed UTF-8 sequence");
|
||||
}
|
||||
int b = buf[offset + count++];
|
||||
int c = buf[offset + count++];
|
||||
if (((b & 0xC0) != 0x80) || ((c & 0xC0) != 0x80)) {
|
||||
throw new TUTFDataFormatException(TString.wrap("Malformed UTF-8 sequence"));
|
||||
throw new TUTFDataFormatException("Malformed UTF-8 sequence");
|
||||
}
|
||||
out[s++] = (char) (((a & 0x0F) << 12) | ((b & 0x3F) << 6) | (c & 0x3F));
|
||||
} else {
|
||||
throw new TUTFDataFormatException(TString.wrap("Malformed UTF-8 sequence"));
|
||||
throw new TUTFDataFormatException("Malformed UTF-8 sequence");
|
||||
}
|
||||
}
|
||||
return new TString(out, 0, s);
|
||||
return new String(out, 0, s);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,34 +15,35 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
|
||||
public interface TDataOutput {
|
||||
void write(int b) throws TIOException;
|
||||
void write(int b) throws IOException;
|
||||
|
||||
void write(byte[] b) throws TIOException;
|
||||
void write(byte[] b) throws IOException;
|
||||
|
||||
void write(byte[] b, int off, int len) throws TIOException;
|
||||
void write(byte[] b, int off, int len) throws IOException;
|
||||
|
||||
void writeBoolean(boolean v) throws TIOException;
|
||||
void writeBoolean(boolean v) throws IOException;
|
||||
|
||||
void writeByte(int v) throws TIOException;
|
||||
void writeByte(int v) throws IOException;
|
||||
|
||||
void writeShort(int v) throws TIOException;
|
||||
void writeShort(int v) throws IOException;
|
||||
|
||||
void writeChar(int v) throws TIOException;
|
||||
void writeChar(int v) throws IOException;
|
||||
|
||||
void writeInt(int v) throws TIOException;
|
||||
void writeInt(int v) throws IOException;
|
||||
|
||||
void writeLong(long v) throws TIOException;
|
||||
void writeLong(long v) throws IOException;
|
||||
|
||||
void writeFloat(float v) throws TIOException;
|
||||
void writeFloat(float v) throws IOException;
|
||||
|
||||
void writeDouble(double v) throws TIOException;
|
||||
void writeDouble(double v) throws IOException;
|
||||
|
||||
void writeBytes(TString s) throws TIOException;
|
||||
void writeBytes(TString s) throws IOException;
|
||||
|
||||
void writeChars(TString s) throws TIOException;
|
||||
void writeChars(TString s) throws IOException;
|
||||
|
||||
void writeUTF(TString s) throws TIOException;
|
||||
void writeUTF(TString s) throws IOException;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.lang.*;
|
||||
|
||||
public class TDataOutputStream extends TFilterOutputStream implements TDataOutput {
|
||||
|
@ -29,7 +30,7 @@ public class TDataOutputStream extends TFilterOutputStream implements TDataOutpu
|
|||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws TIOException {
|
||||
public void flush() throws IOException {
|
||||
super.flush();
|
||||
}
|
||||
|
||||
|
@ -41,7 +42,7 @@ public class TDataOutputStream extends TFilterOutputStream implements TDataOutpu
|
|||
}
|
||||
|
||||
@Override
|
||||
public void write(byte[] buffer, int offset, int count) throws TIOException {
|
||||
public void write(byte[] buffer, int offset, int count) throws IOException {
|
||||
if (buffer == null) {
|
||||
throw new TNullPointerException();
|
||||
}
|
||||
|
@ -50,25 +51,25 @@ public class TDataOutputStream extends TFilterOutputStream implements TDataOutpu
|
|||
}
|
||||
|
||||
@Override
|
||||
public void write(int oneByte) throws TIOException {
|
||||
public void write(int oneByte) throws IOException {
|
||||
out.write(oneByte);
|
||||
written++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void writeBoolean(boolean val) throws TIOException {
|
||||
public final void writeBoolean(boolean val) throws IOException {
|
||||
out.write(val ? 1 : 0);
|
||||
written++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void writeByte(int val) throws TIOException {
|
||||
public final void writeByte(int val) throws IOException {
|
||||
out.write(val);
|
||||
written++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void writeBytes(TString str) throws TIOException {
|
||||
public final void writeBytes(TString str) throws IOException {
|
||||
if (str.length() == 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -81,7 +82,7 @@ public class TDataOutputStream extends TFilterOutputStream implements TDataOutpu
|
|||
}
|
||||
|
||||
@Override
|
||||
public final void writeChar(int val) throws TIOException {
|
||||
public final void writeChar(int val) throws IOException {
|
||||
buff[0] = (byte) (val >> 8);
|
||||
buff[1] = (byte) val;
|
||||
out.write(buff, 0, 2);
|
||||
|
@ -89,7 +90,7 @@ public class TDataOutputStream extends TFilterOutputStream implements TDataOutpu
|
|||
}
|
||||
|
||||
@Override
|
||||
public final void writeChars(TString str) throws TIOException {
|
||||
public final void writeChars(TString str) throws IOException {
|
||||
byte[] newBytes = new byte[str.length() * 2];
|
||||
for (int index = 0; index < str.length(); index++) {
|
||||
int newIndex = index == 0 ? index : index * 2;
|
||||
|
@ -101,17 +102,17 @@ public class TDataOutputStream extends TFilterOutputStream implements TDataOutpu
|
|||
}
|
||||
|
||||
@Override
|
||||
public final void writeDouble(double val) throws TIOException {
|
||||
public final void writeDouble(double val) throws IOException {
|
||||
writeLong(TDouble.doubleToLongBits(val));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void writeFloat(float val) throws TIOException {
|
||||
public final void writeFloat(float val) throws IOException {
|
||||
writeInt(TFloat.floatToIntBits(val));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void writeInt(int val) throws TIOException {
|
||||
public final void writeInt(int val) throws IOException {
|
||||
buff[0] = (byte) (val >> 24);
|
||||
buff[1] = (byte) (val >> 16);
|
||||
buff[2] = (byte) (val >> 8);
|
||||
|
@ -121,7 +122,7 @@ public class TDataOutputStream extends TFilterOutputStream implements TDataOutpu
|
|||
}
|
||||
|
||||
@Override
|
||||
public final void writeLong(long val) throws TIOException {
|
||||
public final void writeLong(long val) throws IOException {
|
||||
buff[0] = (byte) (val >> 56);
|
||||
buff[1] = (byte) (val >> 48);
|
||||
buff[2] = (byte) (val >> 40);
|
||||
|
@ -134,7 +135,7 @@ public class TDataOutputStream extends TFilterOutputStream implements TDataOutpu
|
|||
written += 8;
|
||||
}
|
||||
|
||||
int writeLongToBuffer(long val, byte[] buffer, int offset) throws TIOException {
|
||||
int writeLongToBuffer(long val, byte[] buffer, int offset) throws IOException {
|
||||
buffer[offset++] = (byte) (val >> 56);
|
||||
buffer[offset++] = (byte) (val >> 48);
|
||||
buffer[offset++] = (byte) (val >> 40);
|
||||
|
@ -147,24 +148,24 @@ public class TDataOutputStream extends TFilterOutputStream implements TDataOutpu
|
|||
}
|
||||
|
||||
@Override
|
||||
public final void writeShort(int val) throws TIOException {
|
||||
public final void writeShort(int val) throws IOException {
|
||||
buff[0] = (byte) (val >> 8);
|
||||
buff[1] = (byte) val;
|
||||
out.write(buff, 0, 2);
|
||||
written += 2;
|
||||
}
|
||||
|
||||
int writeShortToBuffer(int val, byte[] buffer, int offset) throws TIOException {
|
||||
int writeShortToBuffer(int val, byte[] buffer, int offset) throws IOException {
|
||||
buffer[offset++] = (byte) (val >> 8);
|
||||
buffer[offset++] = (byte) val;
|
||||
return offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void writeUTF(TString str) throws TIOException {
|
||||
public final void writeUTF(TString str) throws IOException {
|
||||
long utfCount = countUTFBytes(str);
|
||||
if (utfCount > 65535) {
|
||||
throw new TIOException(TString.wrap("UTF Error"));
|
||||
throw new IOException("UTF Error");
|
||||
}
|
||||
byte[] buffer = new byte[(int) utfCount + 2];
|
||||
int offset = 0;
|
||||
|
@ -189,7 +190,7 @@ public class TDataOutputStream extends TFilterOutputStream implements TDataOutpu
|
|||
return utfCount;
|
||||
}
|
||||
|
||||
int writeUTFBytesToBuffer(TString str, byte[] buffer, int offset) throws TIOException {
|
||||
int writeUTFBytesToBuffer(TString str, byte[] buffer, int offset) throws IOException {
|
||||
int length = str.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
int charValue = str.charAt(i);
|
||||
|
|
|
@ -15,16 +15,16 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TEOFException extends TIOException {
|
||||
public class TEOFException extends IOException {
|
||||
private static final long serialVersionUID = 3045477060413545010L;
|
||||
|
||||
public TEOFException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public TEOFException(TString message) {
|
||||
public TEOFException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TFilterInputStream extends TInputStream {
|
||||
protected volatile TInputStream in;
|
||||
|
||||
|
@ -23,12 +25,12 @@ public class TFilterInputStream extends TInputStream {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int available() throws TIOException {
|
||||
public int available() throws IOException {
|
||||
return in.available();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws TIOException {
|
||||
public void close() throws IOException {
|
||||
in.close();
|
||||
}
|
||||
|
||||
|
@ -43,27 +45,27 @@ public class TFilterInputStream extends TInputStream {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int read() throws TIOException {
|
||||
public int read() throws IOException {
|
||||
return in.read();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer) throws TIOException {
|
||||
public int read(byte[] buffer) throws IOException {
|
||||
return read(buffer, 0, buffer.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int count) throws TIOException {
|
||||
public int read(byte[] buffer, int offset, int count) throws IOException {
|
||||
return in.read(buffer, offset, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void reset() throws TIOException {
|
||||
public synchronized void reset() throws IOException {
|
||||
in.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long skip(long count) throws TIOException {
|
||||
public long skip(long count) throws IOException {
|
||||
return in.skip(count);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TFilterOutputStream extends TOutputStream {
|
||||
protected TOutputStream out;
|
||||
|
||||
|
@ -23,22 +25,22 @@ public class TFilterOutputStream extends TOutputStream {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void write(int b) throws TIOException {
|
||||
public void write(int b) throws IOException {
|
||||
out.write(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws TIOException {
|
||||
public void close() throws IOException {
|
||||
try {
|
||||
out.flush();
|
||||
} catch (TIOException e) {
|
||||
} catch (IOException e) {
|
||||
// do nothing
|
||||
}
|
||||
out.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws TIOException {
|
||||
public void flush() throws IOException {
|
||||
out.flush();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface TFlushable {
|
||||
void flush() throws TIOException;
|
||||
void flush() throws IOException;
|
||||
}
|
||||
|
|
|
@ -15,26 +15,22 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import org.teavm.classlib.java.lang.TException;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import org.teavm.classlib.java.lang.TThrowable;
|
||||
|
||||
public class TIOException extends TException {
|
||||
public class TIOException extends Exception {
|
||||
private static final long serialVersionUID = 3626109154700059455L;
|
||||
|
||||
public TIOException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public TIOException(TString message, TThrowable cause) {
|
||||
public TIOException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TIOException(TString message) {
|
||||
public TIOException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public TIOException(TThrowable cause) {
|
||||
public TIOException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.lang.TInteger;
|
||||
import org.teavm.classlib.java.lang.TObject;
|
||||
|
||||
|
@ -22,13 +23,13 @@ public abstract class TInputStream extends TObject implements TCloseable {
|
|||
public TInputStream() {
|
||||
}
|
||||
|
||||
public abstract int read() throws TIOException;
|
||||
public abstract int read() throws IOException;
|
||||
|
||||
public int read(byte[] b) throws TIOException {
|
||||
public int read(byte[] b) throws IOException {
|
||||
return read(b, 0, b.length);
|
||||
}
|
||||
|
||||
public int read(byte[] b, int off, int len) throws TIOException {
|
||||
public int read(byte[] b, int off, int len) throws IOException {
|
||||
for (int i = 0; i < len; ++i) {
|
||||
int bt = read();
|
||||
if (bt < 0) {
|
||||
|
@ -39,7 +40,7 @@ public abstract class TInputStream extends TObject implements TCloseable {
|
|||
return len > 0 ? len : -1;
|
||||
}
|
||||
|
||||
public long skip(long n) throws TIOException {
|
||||
public long skip(long n) throws IOException {
|
||||
if (n < TInteger.MAX_VALUE) {
|
||||
return skip((int) n);
|
||||
} else {
|
||||
|
@ -52,7 +53,7 @@ public abstract class TInputStream extends TObject implements TCloseable {
|
|||
}
|
||||
}
|
||||
|
||||
private int skip(int n) throws TIOException {
|
||||
private int skip(int n) throws IOException {
|
||||
for (int i = 0; i < n; ++i) {
|
||||
if (read() < 0) {
|
||||
return i;
|
||||
|
@ -61,19 +62,19 @@ public abstract class TInputStream extends TObject implements TCloseable {
|
|||
return n;
|
||||
}
|
||||
|
||||
public int available() throws TIOException {
|
||||
public int available() throws IOException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws TIOException {
|
||||
public void close() throws IOException {
|
||||
}
|
||||
|
||||
public void mark(@SuppressWarnings("unused") int readlimit) {
|
||||
}
|
||||
|
||||
public void reset() throws TIOException {
|
||||
throw new TIOException();
|
||||
public void reset() throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
public boolean markSupported() {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.nio.TByteBuffer;
|
||||
import org.teavm.classlib.java.nio.TCharBuffer;
|
||||
import org.teavm.classlib.java.nio.charset.TCharset;
|
||||
|
@ -34,7 +34,7 @@ public class TInputStreamReader extends TReader {
|
|||
private boolean streamEof;
|
||||
private boolean eof;
|
||||
|
||||
public TInputStreamReader(TInputStream in, TString charsetName) throws TUnsupportedEncodingException {
|
||||
public TInputStreamReader(TInputStream in, String charsetName) throws TUnsupportedEncodingException {
|
||||
this(in, getCharset(charsetName));
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class TInputStreamReader extends TReader {
|
|||
inBuffer.position(inBuffer.limit());
|
||||
}
|
||||
|
||||
private static TCharset getCharset(TString charsetName) throws TUnsupportedEncodingException {
|
||||
private static TCharset getCharset(String charsetName) throws TUnsupportedEncodingException {
|
||||
try {
|
||||
return TCharset.forName(charsetName.toString());
|
||||
} catch (TUnsupportedCharsetException e) {
|
||||
|
@ -63,17 +63,17 @@ public class TInputStreamReader extends TReader {
|
|||
}
|
||||
}
|
||||
|
||||
public TString getEncoding() {
|
||||
return TString.wrap(decoder.charset().name());
|
||||
public String getEncoding() {
|
||||
return decoder.charset().name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws TIOException {
|
||||
public void close() throws IOException {
|
||||
stream.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws TIOException {
|
||||
public int read() throws IOException {
|
||||
if (eof && !outBuffer.hasRemaining()) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class TInputStreamReader extends TReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int read(char[] cbuf, int off, int len) throws TIOException {
|
||||
public int read(char[] cbuf, int off, int len) throws IOException {
|
||||
if (eof && !outBuffer.hasRemaining()) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ public class TInputStreamReader extends TReader {
|
|||
return bytesRead;
|
||||
}
|
||||
|
||||
private boolean fillBuffer() throws TIOException {
|
||||
private boolean fillBuffer() throws IOException {
|
||||
if (eof) {
|
||||
return false;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ public class TInputStreamReader extends TReader {
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean fillReadBuffer() throws TIOException {
|
||||
private boolean fillReadBuffer() throws IOException {
|
||||
if (streamEof) {
|
||||
return false;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ public class TInputStreamReader extends TReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean ready() throws TIOException {
|
||||
public boolean ready() throws IOException {
|
||||
return outBuffer.hasRemaining() || inBuffer.hasRemaining();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,26 +15,27 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.lang.TObject;
|
||||
|
||||
public abstract class TOutputStream extends TObject implements TCloseable, TFlushable {
|
||||
public abstract void write(int b) throws TIOException;
|
||||
public abstract void write(int b) throws IOException;
|
||||
|
||||
public void write(byte[] b) throws TIOException {
|
||||
public void write(byte[] b) throws IOException {
|
||||
write(b, 0, b.length);
|
||||
}
|
||||
|
||||
public void write(byte[] b, int off, int len) throws TIOException {
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
for (int i = 0; i < len; ++i) {
|
||||
write(b[off++]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws TIOException {
|
||||
public void close() throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws TIOException {
|
||||
public void flush() throws IOException {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,10 +15,14 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.nio.TByteBuffer;
|
||||
import org.teavm.classlib.java.nio.TCharBuffer;
|
||||
import org.teavm.classlib.java.nio.charset.*;
|
||||
import org.teavm.classlib.java.nio.charset.TCharset;
|
||||
import org.teavm.classlib.java.nio.charset.TCharsetEncoder;
|
||||
import org.teavm.classlib.java.nio.charset.TCodingErrorAction;
|
||||
import org.teavm.classlib.java.nio.charset.TIllegalCharsetNameException;
|
||||
import org.teavm.classlib.java.nio.charset.TUnsupportedCharsetException;
|
||||
import org.teavm.classlib.java.nio.charset.impl.TUTF8Charset;
|
||||
|
||||
public class TOutputStreamWriter extends TWriter {
|
||||
|
@ -61,12 +65,12 @@ public class TOutputStreamWriter extends TWriter {
|
|||
try {
|
||||
return TCharset.forName(charsetName);
|
||||
} catch (TUnsupportedCharsetException | TIllegalCharsetNameException e) {
|
||||
throw new TUnsupportedEncodingException(TString.wrap(charsetName));
|
||||
throw new TUnsupportedEncodingException(charsetName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws TIOException {
|
||||
public void close() throws IOException {
|
||||
if (!closed) {
|
||||
flush();
|
||||
closed = true;
|
||||
|
@ -76,7 +80,7 @@ public class TOutputStreamWriter extends TWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws TIOException {
|
||||
public void flush() throws IOException {
|
||||
checkStatus();
|
||||
if (buffer.position() > 0) {
|
||||
out.write(bufferData, 0, buffer.position());
|
||||
|
@ -85,9 +89,9 @@ public class TOutputStreamWriter extends TWriter {
|
|||
out.flush();
|
||||
}
|
||||
|
||||
private void checkStatus() throws TIOException {
|
||||
private void checkStatus() throws IOException {
|
||||
if (closed) {
|
||||
throw new TIOException(TString.wrap("Writer already closed"));
|
||||
throw new IOException("Writer already closed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +100,7 @@ public class TOutputStreamWriter extends TWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void write(char[] buf, int offset, int count) throws TIOException {
|
||||
public void write(char[] buf, int offset, int count) throws IOException {
|
||||
synchronized (lock) {
|
||||
checkStatus();
|
||||
if (buf == null) {
|
||||
|
@ -116,13 +120,13 @@ public class TOutputStreamWriter extends TWriter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void write(int oneChar) throws TIOException {
|
||||
public void write(int oneChar) throws IOException {
|
||||
char[] array = { (char) oneChar };
|
||||
write(array, 0, array.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(String str, int offset, int count) throws TIOException {
|
||||
public void write(String str, int offset, int count) throws IOException {
|
||||
if (str == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
|
|
@ -15,13 +15,17 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.lang.TMath;
|
||||
import org.teavm.classlib.java.lang.TObject;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import org.teavm.classlib.java.lang.TStringBuilder;
|
||||
import org.teavm.classlib.java.nio.TByteBuffer;
|
||||
import org.teavm.classlib.java.nio.TCharBuffer;
|
||||
import org.teavm.classlib.java.nio.charset.*;
|
||||
import org.teavm.classlib.java.nio.charset.TCharset;
|
||||
import org.teavm.classlib.java.nio.charset.TCharsetEncoder;
|
||||
import org.teavm.classlib.java.nio.charset.TCodingErrorAction;
|
||||
import org.teavm.classlib.java.nio.charset.TIllegalCharsetNameException;
|
||||
import org.teavm.classlib.java.nio.charset.TUnsupportedCharsetException;
|
||||
import org.teavm.classlib.java.nio.charset.impl.TUTF8Charset;
|
||||
|
||||
public class TPrintStream extends TFilterOutputStream {
|
||||
|
@ -31,7 +35,7 @@ public class TPrintStream extends TFilterOutputStream {
|
|||
private char[] buffer = new char[32];
|
||||
private TCharset charset;
|
||||
|
||||
public TPrintStream(TOutputStream out, boolean autoFlush, TString encoding) throws TUnsupportedEncodingException {
|
||||
public TPrintStream(TOutputStream out, boolean autoFlush, String encoding) throws TUnsupportedEncodingException {
|
||||
super(out);
|
||||
this.autoFlush = autoFlush;
|
||||
try {
|
||||
|
@ -71,7 +75,7 @@ public class TPrintStream extends TFilterOutputStream {
|
|||
}
|
||||
try {
|
||||
out.write(b);
|
||||
} catch (TIOException e) {
|
||||
} catch (IOException e) {
|
||||
errorState = true;
|
||||
}
|
||||
if (autoFlush && !errorState) {
|
||||
|
@ -86,19 +90,19 @@ public class TPrintStream extends TFilterOutputStream {
|
|||
}
|
||||
try {
|
||||
out.write(b, off, len);
|
||||
} catch (TIOException e) {
|
||||
} catch (IOException e) {
|
||||
errorState = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws TIOException {
|
||||
public void close() {
|
||||
if (!checkError()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
out.close();
|
||||
} catch (TIOException e) {
|
||||
} catch (IOException e) {
|
||||
errorState = true;
|
||||
} finally {
|
||||
out = null;
|
||||
|
@ -106,13 +110,13 @@ public class TPrintStream extends TFilterOutputStream {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void flush() throws TIOException {
|
||||
public void flush() {
|
||||
if (!check()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
out.flush();
|
||||
} catch (TIOException e) {
|
||||
} catch (IOException e) {
|
||||
errorState = true;
|
||||
}
|
||||
}
|
||||
|
@ -173,7 +177,7 @@ public class TPrintStream extends TFilterOutputStream {
|
|||
printSB();
|
||||
}
|
||||
|
||||
public void print(TString s) {
|
||||
public void print(String s) {
|
||||
sb.append(s);
|
||||
printSB();
|
||||
}
|
||||
|
@ -198,7 +202,7 @@ public class TPrintStream extends TFilterOutputStream {
|
|||
printSB();
|
||||
}
|
||||
|
||||
public void println(TString s) {
|
||||
public void println(String s) {
|
||||
sb.append(s).append('\n');
|
||||
printSB();
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.lang.TArrayIndexOutOfBoundsException;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
|
||||
public class TPushbackInputStream extends TFilterInputStream {
|
||||
protected byte[] buf;
|
||||
|
@ -38,15 +38,15 @@ public class TPushbackInputStream extends TFilterInputStream {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int available() throws TIOException {
|
||||
public int available() throws IOException {
|
||||
if (buf == null) {
|
||||
throw new TIOException();
|
||||
throw new IOException();
|
||||
}
|
||||
return buf.length - pos + in.available();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws TIOException {
|
||||
public void close() throws IOException {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
in = null;
|
||||
|
@ -60,9 +60,9 @@ public class TPushbackInputStream extends TFilterInputStream {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int read() throws TIOException {
|
||||
public int read() throws IOException {
|
||||
if (buf == null) {
|
||||
throw new TIOException();
|
||||
throw new IOException();
|
||||
}
|
||||
// Is there a pushback byte available?
|
||||
if (pos < buf.length) {
|
||||
|
@ -74,16 +74,16 @@ public class TPushbackInputStream extends TFilterInputStream {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int length) throws TIOException {
|
||||
public int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
if (buf == null) {
|
||||
throw new TIOException(TString.wrap("Stream is closed"));
|
||||
throw new IOException("Stream is closed");
|
||||
}
|
||||
// Force buffer null check first!
|
||||
if (offset > buffer.length || offset < 0) {
|
||||
throw new TArrayIndexOutOfBoundsException(TString.wrap("Offset out of bounds: " + offset));
|
||||
throw new TArrayIndexOutOfBoundsException("Offset out of bounds: " + offset);
|
||||
}
|
||||
if (length < 0 || length > buffer.length - offset) {
|
||||
throw new TArrayIndexOutOfBoundsException(TString.wrap("Length out of bounds: " + length));
|
||||
throw new TArrayIndexOutOfBoundsException("Length out of bounds: " + length);
|
||||
}
|
||||
|
||||
int copiedBytes = 0;
|
||||
|
@ -113,9 +113,9 @@ public class TPushbackInputStream extends TFilterInputStream {
|
|||
}
|
||||
|
||||
@Override
|
||||
public long skip(long count) throws TIOException {
|
||||
public long skip(long count) throws IOException {
|
||||
if (in == null) {
|
||||
throw new TIOException();
|
||||
throw new IOException();
|
||||
}
|
||||
if (count <= 0) {
|
||||
return 0;
|
||||
|
@ -131,44 +131,43 @@ public class TPushbackInputStream extends TFilterInputStream {
|
|||
return numSkipped;
|
||||
}
|
||||
|
||||
public void unread(byte[] buffer) throws TIOException {
|
||||
public void unread(byte[] buffer) throws IOException {
|
||||
unread(buffer, 0, buffer.length);
|
||||
}
|
||||
|
||||
public void unread(byte[] buffer, int offset, int length) throws TIOException {
|
||||
public void unread(byte[] buffer, int offset, int length) throws IOException {
|
||||
if (length > pos) {
|
||||
throw new TIOException(TString.wrap("Pushback buffer full"));
|
||||
throw new IOException("Pushback buffer full");
|
||||
}
|
||||
if (offset > buffer.length || offset < 0) {
|
||||
throw new TArrayIndexOutOfBoundsException(TString.wrap("Offset out of bounds: " + offset));
|
||||
throw new TArrayIndexOutOfBoundsException("Offset out of bounds: " + offset);
|
||||
}
|
||||
if (length < 0 || length > buffer.length - offset) {
|
||||
throw new TArrayIndexOutOfBoundsException(TString.wrap("Length out of bounds: " + length));
|
||||
throw new TArrayIndexOutOfBoundsException("Length out of bounds: " + length);
|
||||
}
|
||||
if (buf == null) {
|
||||
throw new TIOException(TString.wrap("Stream is closed"));
|
||||
throw new IOException("Stream is closed");
|
||||
}
|
||||
System.arraycopy(buffer, offset, buf, pos - length, length);
|
||||
pos = pos - length;
|
||||
}
|
||||
|
||||
public void unread(int oneByte) throws TIOException {
|
||||
public void unread(int oneByte) throws IOException {
|
||||
if (buf == null) {
|
||||
throw new TIOException();
|
||||
throw new IOException();
|
||||
}
|
||||
if (pos == 0) {
|
||||
throw new TIOException();
|
||||
throw new IOException();
|
||||
}
|
||||
buf[--pos] = (byte) oneByte;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mark(int readlimit) {
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() throws TIOException {
|
||||
throw new TIOException();
|
||||
public void reset() throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -456,7 +456,7 @@ public class TRandomAccessFile implements DataInput, DataOutput, Closeable {
|
|||
return new String(out, 0, s);
|
||||
}
|
||||
|
||||
static int writeShortToBuffer(int val, byte[] buffer, int offset) throws TIOException {
|
||||
static int writeShortToBuffer(int val, byte[] buffer, int offset) throws IOException {
|
||||
buffer[offset++] = (byte) (val >> 8);
|
||||
buffer[offset++] = (byte) val;
|
||||
return offset;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.lang.TMath;
|
||||
import org.teavm.classlib.java.lang.TObject;
|
||||
|
||||
|
@ -29,18 +30,18 @@ public abstract class TReader implements TCloseable {
|
|||
this.lock = lock;
|
||||
}
|
||||
|
||||
public int read() throws TIOException {
|
||||
public int read() throws IOException {
|
||||
char[] buf = new char[1];
|
||||
return read(buf) >= 0 ? buf[0] : -1;
|
||||
}
|
||||
|
||||
public int read(char[] cbuf) throws TIOException {
|
||||
public int read(char[] cbuf) throws IOException {
|
||||
return read(cbuf, 0, cbuf.length);
|
||||
}
|
||||
|
||||
public abstract int read(char[] cbuf, int off, int len) throws TIOException;
|
||||
public abstract int read(char[] cbuf, int off, int len) throws IOException;
|
||||
|
||||
public long skip(long n) throws TIOException {
|
||||
public long skip(long n) throws IOException {
|
||||
char[] buffer = new char[1024];
|
||||
long skipped = 0;
|
||||
while (skipped < n) {
|
||||
|
@ -53,7 +54,7 @@ public abstract class TReader implements TCloseable {
|
|||
return skipped;
|
||||
}
|
||||
|
||||
public boolean ready() throws TIOException {
|
||||
public boolean ready() throws IOException {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -61,11 +62,11 @@ public abstract class TReader implements TCloseable {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void mark(@SuppressWarnings("unused") int readAheadLimit) throws TIOException {
|
||||
throw new TIOException();
|
||||
public void mark(@SuppressWarnings("unused") int readAheadLimit) throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
|
||||
public void reset() throws TIOException {
|
||||
throw new TIOException();
|
||||
public void reset() throws IOException {
|
||||
throw new IOException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.lang.TIllegalArgumentException;
|
||||
import org.teavm.classlib.java.lang.TMath;
|
||||
import org.teavm.classlib.java.lang.TNullPointerException;
|
||||
|
@ -33,7 +34,7 @@ public class TStringReader extends TReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int read() throws TIOException {
|
||||
public int read() throws IOException {
|
||||
checkOpened();
|
||||
if (index >= string.length()) {
|
||||
return -1;
|
||||
|
@ -42,7 +43,7 @@ public class TStringReader extends TReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int read(char[] cbuf, int off, int len) throws TIOException {
|
||||
public int read(char[] cbuf, int off, int len) throws IOException {
|
||||
checkOpened();
|
||||
if (index >= string.length()) {
|
||||
return -1;
|
||||
|
@ -55,7 +56,7 @@ public class TStringReader extends TReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public long skip(long n) throws TIOException {
|
||||
public long skip(long n) throws IOException {
|
||||
checkOpened();
|
||||
if (n < 0) {
|
||||
n = TMath.max(n, -index);
|
||||
|
@ -67,7 +68,7 @@ public class TStringReader extends TReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean ready() throws TIOException {
|
||||
public boolean ready() throws IOException {
|
||||
checkOpened();
|
||||
return true;
|
||||
}
|
||||
|
@ -78,7 +79,7 @@ public class TStringReader extends TReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void mark(int readAheadLimit) throws TIOException {
|
||||
public void mark(int readAheadLimit) throws IOException {
|
||||
checkOpened();
|
||||
if (readAheadLimit < 0) {
|
||||
throw new TIllegalArgumentException();
|
||||
|
@ -87,7 +88,7 @@ public class TStringReader extends TReader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void reset() throws TIOException {
|
||||
public void reset() throws IOException {
|
||||
checkOpened();
|
||||
index = mark;
|
||||
}
|
||||
|
@ -97,9 +98,9 @@ public class TStringReader extends TReader {
|
|||
string = null;
|
||||
}
|
||||
|
||||
private void checkOpened() throws TIOException {
|
||||
private void checkOpened() throws IOException {
|
||||
if (string == null) {
|
||||
throw new TIOException();
|
||||
throw new IOException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,16 +15,16 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import java.io.IOException;
|
||||
|
||||
public class TUTFDataFormatException extends TIOException {
|
||||
public class TUTFDataFormatException extends IOException {
|
||||
private static final long serialVersionUID = -6383472574962319733L;
|
||||
|
||||
public TUTFDataFormatException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public TUTFDataFormatException(TString message) {
|
||||
public TUTFDataFormatException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
|
||||
public class TUnsupportedEncodingException extends TIOException {
|
||||
private static final long serialVersionUID = 2403781130729330252L;
|
||||
|
||||
|
@ -24,7 +22,7 @@ public class TUnsupportedEncodingException extends TIOException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TUnsupportedEncodingException(TString message) {
|
||||
public TUnsupportedEncodingException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.lang.TAppendable;
|
||||
import org.teavm.classlib.java.lang.TCharSequence;
|
||||
|
||||
|
@ -33,13 +34,13 @@ public abstract class TWriter implements TAppendable, TCloseable, TFlushable {
|
|||
this.lock = lock;
|
||||
}
|
||||
|
||||
public void write(char[] buf) throws TIOException {
|
||||
public void write(char[] buf) throws IOException {
|
||||
write(buf, 0, buf.length);
|
||||
}
|
||||
|
||||
public abstract void write(char[] buf, int offset, int count) throws TIOException;
|
||||
public abstract void write(char[] buf, int offset, int count) throws IOException;
|
||||
|
||||
public void write(int oneChar) throws TIOException {
|
||||
public void write(int oneChar) throws IOException {
|
||||
synchronized (lock) {
|
||||
char[] oneCharArray = new char[1];
|
||||
oneCharArray[0] = (char) oneChar;
|
||||
|
@ -47,11 +48,11 @@ public abstract class TWriter implements TAppendable, TCloseable, TFlushable {
|
|||
}
|
||||
}
|
||||
|
||||
public void write(String str) throws TIOException {
|
||||
public void write(String str) throws IOException {
|
||||
write(str, 0, str.length());
|
||||
}
|
||||
|
||||
public void write(String str, int offset, int count) throws TIOException {
|
||||
public void write(String str, int offset, int count) throws IOException {
|
||||
if (count < 0) {
|
||||
throw new StringIndexOutOfBoundsException();
|
||||
}
|
||||
|
@ -63,19 +64,19 @@ public abstract class TWriter implements TAppendable, TCloseable, TFlushable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TWriter append(char c) throws TIOException {
|
||||
public TWriter append(char c) throws IOException {
|
||||
write(c);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TWriter append(TCharSequence csq) throws TIOException {
|
||||
public TWriter append(TCharSequence csq) throws IOException {
|
||||
write(csq != null ? csq.toString() : "null");
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TWriter append(TCharSequence csq, int start, int end) throws TIOException {
|
||||
public TWriter append(TCharSequence csq, int start, int end) throws IOException {
|
||||
write(csq != null ? csq.subSequence(start, end).toString() : "null");
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -56,16 +56,16 @@ class TAbstractStringBuilder extends TObject implements TSerializable, TCharSequ
|
|||
length = value.length();
|
||||
}
|
||||
|
||||
protected TAbstractStringBuilder append(TString string) {
|
||||
protected TAbstractStringBuilder append(String string) {
|
||||
return insert(length, string);
|
||||
}
|
||||
|
||||
protected TAbstractStringBuilder insert(int index, TString string) {
|
||||
protected TAbstractStringBuilder insert(int index, String string) {
|
||||
if (index < 0 || index > length) {
|
||||
throw new TStringIndexOutOfBoundsException();
|
||||
}
|
||||
if (string == null) {
|
||||
string = TString.wrap("null");
|
||||
string = "null";
|
||||
} else if (string.isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ class TAbstractStringBuilder extends TObject implements TSerializable, TCharSequ
|
|||
}
|
||||
|
||||
protected TAbstractStringBuilder insert(int index, TObject obj) {
|
||||
return insert(index, TString.wrap(obj != null ? obj.toString() : "null"));
|
||||
return insert(index, obj != null ? obj.toString() : "null");
|
||||
}
|
||||
|
||||
protected TAbstractStringBuilder append(boolean b) {
|
||||
|
@ -510,7 +510,7 @@ class TAbstractStringBuilder extends TObject implements TSerializable, TCharSequ
|
|||
}
|
||||
|
||||
protected TAbstractStringBuilder insert(int index, boolean b) {
|
||||
return insert(index, b ? TString.wrap("true") : TString.wrap("false"));
|
||||
return insert(index, b ? "true" : "false");
|
||||
}
|
||||
|
||||
public void ensureCapacity(int capacity) {
|
||||
|
@ -606,7 +606,7 @@ class TAbstractStringBuilder extends TObject implements TSerializable, TCharSequ
|
|||
|
||||
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) {
|
||||
if (srcBegin > srcEnd) {
|
||||
throw new TIndexOutOfBoundsException(TString.wrap("Index out of bounds"));
|
||||
throw new IndexOutOfBoundsException("Index out of bounds");
|
||||
}
|
||||
while (srcBegin < srcEnd) {
|
||||
dst[dstBegin++] = buffer[srcBegin++];
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.lang;
|
||||
|
||||
import org.teavm.classlib.java.io.TIOException;
|
||||
import java.io.IOException;
|
||||
|
||||
public interface TAppendable {
|
||||
TAppendable append(TCharSequence csq) throws TIOException;
|
||||
TAppendable append(TCharSequence csq) throws IOException;
|
||||
|
||||
TAppendable append(TCharSequence csq, int start, int end) throws TIOException;
|
||||
TAppendable append(TCharSequence csq, int start, int end) throws IOException;
|
||||
|
||||
TAppendable append(char c) throws TIOException;
|
||||
TAppendable append(char c) throws IOException;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TArithmeticException extends TRuntimeException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TArithmeticException(TString message) {
|
||||
public TArithmeticException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,11 +22,11 @@ public class TArrayIndexOutOfBoundsException extends TIndexOutOfBoundsException
|
|||
super();
|
||||
}
|
||||
|
||||
public TArrayIndexOutOfBoundsException(TString message) {
|
||||
public TArrayIndexOutOfBoundsException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public TArrayIndexOutOfBoundsException(int index) {
|
||||
super(TString.wrap(Integer.toString(index)));
|
||||
super(Integer.toString(index));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TArrayStoreException extends TRuntimeException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TArrayStoreException(TString message) {
|
||||
public TArrayStoreException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,11 +22,11 @@ public class TAssertionError extends TError {
|
|||
super();
|
||||
}
|
||||
|
||||
public TAssertionError(TString message, TThrowable cause) {
|
||||
public TAssertionError(String message, TThrowable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TAssertionError(TObject message) {
|
||||
public TAssertionError(Object message) {
|
||||
super(TString.valueOf(message));
|
||||
}
|
||||
|
||||
|
|
|
@ -16,5 +16,5 @@
|
|||
package org.teavm.classlib.java.lang;
|
||||
|
||||
public interface TAutoCloseable {
|
||||
void close() throws TException;
|
||||
void close() throws Exception;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class TBoolean extends TObject implements TSerializable, TComparable<TBoo
|
|||
this.value = value;
|
||||
}
|
||||
|
||||
public TBoolean(TString value) {
|
||||
public TBoolean(String value) {
|
||||
this.value = parseBoolean(value);
|
||||
}
|
||||
|
||||
|
@ -49,8 +49,8 @@ public class TBoolean extends TObject implements TSerializable, TComparable<TBoo
|
|||
return 0;
|
||||
}
|
||||
|
||||
public static boolean parseBoolean(TString s) {
|
||||
return s != null && s.toLowerCase().equals(TString.wrap("true"));
|
||||
public static boolean parseBoolean(String s) {
|
||||
return s != null && s.toLowerCase().equals("true");
|
||||
}
|
||||
|
||||
public boolean booleanValue() {
|
||||
|
@ -61,7 +61,7 @@ public class TBoolean extends TObject implements TSerializable, TComparable<TBoo
|
|||
return value ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
public static TBoolean valueOf(TString value) {
|
||||
public static TBoolean valueOf(String value) {
|
||||
return valueOf(parseBoolean(value));
|
||||
}
|
||||
|
||||
|
@ -87,8 +87,8 @@ public class TBoolean extends TObject implements TSerializable, TComparable<TBoo
|
|||
return obj instanceof TBoolean && ((TBoolean) obj).value == value;
|
||||
}
|
||||
|
||||
public static boolean getBoolean(TString key) {
|
||||
String stringValue = key != null ? TSystem.getProperty((String) (Object) key) : null;
|
||||
return stringValue != null && valueOf(TString.wrap(stringValue)).booleanValue();
|
||||
public static boolean getBoolean(String key) {
|
||||
String stringValue = key != null ? TSystem.getProperty(key) : null;
|
||||
return stringValue != null && valueOf(stringValue).booleanValue();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class TByte extends TNumber implements TComparable<TByte> {
|
|||
this.value = value;
|
||||
}
|
||||
|
||||
public TByte(TString value) {
|
||||
public TByte(String value) {
|
||||
this.value = parseByte(value, 10);
|
||||
}
|
||||
|
||||
|
@ -88,11 +88,11 @@ public class TByte extends TNumber implements TComparable<TByte> {
|
|||
return compare(value, other.value);
|
||||
}
|
||||
|
||||
public static byte parseByte(TString s) throws TNumberFormatException {
|
||||
public static byte parseByte(String s) throws TNumberFormatException {
|
||||
return parseByte(s, 10);
|
||||
}
|
||||
|
||||
public static byte parseByte(TString s, int radix) throws TNumberFormatException {
|
||||
public static byte parseByte(String s, int radix) throws TNumberFormatException {
|
||||
int value = TInteger.parseInt(s, radix);
|
||||
if (value < MIN_VALUE || value >= MAX_VALUE) {
|
||||
throw new TNumberFormatException();
|
||||
|
@ -100,15 +100,15 @@ public class TByte extends TNumber implements TComparable<TByte> {
|
|||
return (byte) value;
|
||||
}
|
||||
|
||||
public static TByte valueOf(TString s, int radix) throws TNumberFormatException {
|
||||
public static TByte valueOf(String s, int radix) throws TNumberFormatException {
|
||||
return valueOf(parseByte(s, radix));
|
||||
}
|
||||
|
||||
public static TByte valueOf(TString s) throws TNumberFormatException {
|
||||
public static TByte valueOf(String s) throws TNumberFormatException {
|
||||
return valueOf(parseByte(s));
|
||||
}
|
||||
|
||||
public static TByte decode(TString nm) throws TNumberFormatException {
|
||||
public static TByte decode(String nm) throws TNumberFormatException {
|
||||
TInteger value = TInteger.decode(nm);
|
||||
if (value.intValue() < MIN_VALUE || value.intValue() >= MAX_VALUE) {
|
||||
throw new TNumberFormatException();
|
||||
|
|
|
@ -53,8 +53,8 @@ import org.teavm.runtime.RuntimeClass;
|
|||
import org.teavm.runtime.RuntimeObject;
|
||||
|
||||
public class TClass<T> extends TObject implements TAnnotatedElement {
|
||||
TString name;
|
||||
TString simpleName;
|
||||
String name;
|
||||
String simpleName;
|
||||
private PlatformClass platformClass;
|
||||
private TAnnotation[] annotationsCache;
|
||||
private Map<TClass<?>, TAnnotation> annotationsByType;
|
||||
|
@ -105,22 +105,22 @@ public class TClass<T> extends TObject implements TAnnotatedElement {
|
|||
}
|
||||
|
||||
@Unmanaged
|
||||
public TString getName() {
|
||||
public String getName() {
|
||||
if (PlatformDetector.isLowLevel()) {
|
||||
return TString.wrap(Platform.getName(platformClass));
|
||||
return Platform.getName(platformClass);
|
||||
} else {
|
||||
if (name == null) {
|
||||
name = TString.wrap(Platform.getName(platformClass));
|
||||
name = Platform.getName(platformClass);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public TString getSimpleName() {
|
||||
TString simpleName = getSimpleNameCache();
|
||||
public String getSimpleName() {
|
||||
String simpleName = getSimpleNameCache();
|
||||
if (simpleName == null) {
|
||||
if (isArray()) {
|
||||
simpleName = getComponentType().getSimpleName().concat(TString.wrap("[]"));
|
||||
simpleName = getComponentType().getSimpleName() + "[]";
|
||||
setSimpleNameCache(simpleName);
|
||||
return simpleName;
|
||||
}
|
||||
|
@ -137,14 +137,14 @@ public class TClass<T> extends TObject implements TAnnotatedElement {
|
|||
name = name.substring(lastDot + 1);
|
||||
}
|
||||
}
|
||||
simpleName = TString.wrap(name);
|
||||
simpleName = name;
|
||||
setSimpleNameCache(simpleName);
|
||||
}
|
||||
return simpleName;
|
||||
}
|
||||
|
||||
@DelegateTo("getSimpleNameCacheLowLevel")
|
||||
private TString getSimpleNameCache() {
|
||||
private String getSimpleNameCache() {
|
||||
return simpleName;
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ public class TClass<T> extends TObject implements TAnnotatedElement {
|
|||
return Address.ofObject(this).<RuntimeClass>toStructure().simpleName;
|
||||
}
|
||||
|
||||
private void setSimpleNameCache(TString value) {
|
||||
private void setSimpleNameCache(String value) {
|
||||
simpleName = value;
|
||||
}
|
||||
|
||||
|
@ -559,8 +559,7 @@ public class TClass<T> extends TObject implements TAnnotatedElement {
|
|||
@SuppressWarnings("unchecked")
|
||||
public T cast(TObject obj) {
|
||||
if (obj != null && !isAssignableFrom((TClass<?>) (Object) obj.getClass())) {
|
||||
throw new TClassCastException(TString.wrap(obj.getClass().getName()
|
||||
+ " is not subtype of " + name));
|
||||
throw new TClassCastException(obj.getClass().getName() + " is not subtype of " + name);
|
||||
}
|
||||
return (T) obj;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TClassCastException extends TRuntimeException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TClassCastException(TString message) {
|
||||
public TClassCastException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,11 +22,11 @@ public class TClassNotFoundException extends TReflectiveOperationException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TClassNotFoundException(TString message, TThrowable cause) {
|
||||
public TClassNotFoundException(String message, TThrowable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TClassNotFoundException(TString message) {
|
||||
public TClassNotFoundException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TCloneNotSupportedException extends TException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TCloneNotSupportedException(TString message) {
|
||||
public TCloneNotSupportedException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,18 +15,18 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.lang;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.io.TEOFException;
|
||||
import org.teavm.classlib.java.io.TIOException;
|
||||
import org.teavm.classlib.java.io.TInputStream;
|
||||
|
||||
class TConsoleInputStream extends TInputStream {
|
||||
@Override
|
||||
public int read(byte[] b) throws TIOException {
|
||||
public int read(byte[] b) throws IOException {
|
||||
throw new TEOFException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws TIOException {
|
||||
public int read() throws IOException {
|
||||
throw new TEOFException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.lang;
|
||||
|
||||
import org.teavm.classlib.java.io.TIOException;
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.io.TOutputStream;
|
||||
import org.teavm.interop.DelegateTo;
|
||||
import org.teavm.interop.Import;
|
||||
|
@ -24,7 +24,7 @@ import org.teavm.jso.JSBody;
|
|||
class TConsoleOutputStreamStderr extends TOutputStream {
|
||||
@Override
|
||||
@DelegateTo("writeLowLevel")
|
||||
public void write(int b) throws TIOException {
|
||||
public void write(int b) throws IOException {
|
||||
writeJs(b);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.lang;
|
||||
|
||||
import org.teavm.classlib.java.io.TIOException;
|
||||
import java.io.IOException;
|
||||
import org.teavm.classlib.java.io.TOutputStream;
|
||||
import org.teavm.interop.DelegateTo;
|
||||
import org.teavm.jso.JSBody;
|
||||
|
@ -23,7 +23,7 @@ import org.teavm.jso.JSBody;
|
|||
class TConsoleOutputStreamStdout extends TOutputStream {
|
||||
@Override
|
||||
@DelegateTo("writeLowLevel")
|
||||
public void write(int b) throws TIOException {
|
||||
public void write(int b) throws IOException {
|
||||
writeJs(b);
|
||||
}
|
||||
|
||||
|
|
|
@ -251,11 +251,11 @@ public class TDouble extends TNumber implements TComparable<TDouble> {
|
|||
@Import(name = "teavm_reinterpretLongToDouble")
|
||||
public static native double longBitsToDouble(long bits);
|
||||
|
||||
public static TString toHexString(double d) {
|
||||
public static String toHexString(double d) {
|
||||
if (isNaN(d)) {
|
||||
return TString.wrap("NaN");
|
||||
return "NaN";
|
||||
} else if (isInfinite(d)) {
|
||||
return d > 0 ? TString.wrap("Infinity") : TString.wrap("-Infinity");
|
||||
return d > 0 ? "Infinity" : "-Infinity";
|
||||
}
|
||||
char[] buffer = new char[30];
|
||||
int sz = 0;
|
||||
|
@ -312,6 +312,6 @@ public class TDouble extends TNumber implements TComparable<TDouble> {
|
|||
buffer[sz++] = '0';
|
||||
}
|
||||
|
||||
return new TString(buffer, 0, sz);
|
||||
return new String(buffer, 0, sz);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,8 +64,8 @@ public abstract class TEnum<E extends TEnum<E>> extends TObject implements TComp
|
|||
@Override
|
||||
public final int compareTo(E o) {
|
||||
if (o.getDeclaringClass() != getDeclaringClass()) {
|
||||
throw new TIllegalArgumentException(TString.wrap("Can't compare "
|
||||
+ getDeclaringClass().getName().toString() + " to " + o.getDeclaringClass().getName().toString()));
|
||||
throw new TIllegalArgumentException("Can't compare "
|
||||
+ getDeclaringClass().getName() + " to " + o.getDeclaringClass().getName());
|
||||
}
|
||||
return TInteger.compare(ordinal, o.ordinal());
|
||||
}
|
||||
|
@ -74,14 +74,13 @@ public abstract class TEnum<E extends TEnum<E>> extends TObject implements TComp
|
|||
// TODO: speed-up this method, use caching
|
||||
T[] constants = enumType.getEnumConstants();
|
||||
if (constants == null) {
|
||||
throw new TIllegalArgumentException(TString.wrap("Class does not represent enum: " + enumType.getName()));
|
||||
throw new TIllegalArgumentException("Class does not represent enum: " + enumType.getName());
|
||||
}
|
||||
for (T constant : constants) {
|
||||
if (constant.name().equals(name)) {
|
||||
return constant;
|
||||
}
|
||||
}
|
||||
throw new TIllegalArgumentException(TString.wrap("Enum " + enumType.getName() + " does not have the " + name
|
||||
+ "constant"));
|
||||
throw new TIllegalArgumentException("Enum " + enumType.getName() + " does not have the " + name + "constant");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,11 +21,11 @@ public class TError extends TThrowable {
|
|||
public TError() {
|
||||
}
|
||||
|
||||
public TError(TString message, TThrowable cause) {
|
||||
public TError(String message, TThrowable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TError(TString message) {
|
||||
public TError(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@ public class TException extends TThrowable {
|
|||
super();
|
||||
}
|
||||
|
||||
public TException(TString message, TThrowable cause) {
|
||||
public TException(String message, TThrowable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TException(TString message) {
|
||||
public TException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -256,11 +256,11 @@ public class TFloat extends TNumber implements TComparable<TFloat> {
|
|||
@Import(name = "teavm_reinterpretIntToFloat")
|
||||
public static native float intBitsToFloat(int bits);
|
||||
|
||||
public static TString toHexString(float f) {
|
||||
public static String toHexString(float f) {
|
||||
if (isNaN(f)) {
|
||||
return TString.wrap("NaN");
|
||||
return "NaN";
|
||||
} else if (isInfinite(f)) {
|
||||
return f > 0 ? TString.wrap("Infinity") : TString.wrap("-Infinity");
|
||||
return f > 0 ? "Infinity" : "-Infinity";
|
||||
}
|
||||
char[] buffer = new char[18];
|
||||
int sz = 0;
|
||||
|
@ -317,6 +317,6 @@ public class TFloat extends TNumber implements TComparable<TFloat> {
|
|||
buffer[sz++] = '0';
|
||||
}
|
||||
|
||||
return new TString(buffer, 0, sz);
|
||||
return new String(buffer, 0, sz);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,11 +22,11 @@ public class TIllegalArgumentException extends TRuntimeException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TIllegalArgumentException(TString message, TThrowable cause) {
|
||||
public TIllegalArgumentException(String message, TThrowable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TIllegalArgumentException(TString message) {
|
||||
public TIllegalArgumentException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TIllegalMonitorStateException extends TRuntimeException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TIllegalMonitorStateException(TString message) {
|
||||
public TIllegalMonitorStateException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,11 +22,11 @@ public class TIllegalStateException extends TException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TIllegalStateException(TString message, TThrowable cause) {
|
||||
public TIllegalStateException(String message, TThrowable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TIllegalStateException(TString message) {
|
||||
public TIllegalStateException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TIncompatibleClassChangeError extends TLinkageError {
|
|||
super();
|
||||
}
|
||||
|
||||
public TIncompatibleClassChangeError(TString message) {
|
||||
public TIncompatibleClassChangeError(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TIndexOutOfBoundsException extends TRuntimeException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TIndexOutOfBoundsException(TString message) {
|
||||
public TIndexOutOfBoundsException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public class TInteger extends TNumber implements TComparable<TInteger> {
|
|||
this.value = value;
|
||||
}
|
||||
|
||||
public TInteger(TString s) throws NumberFormatException {
|
||||
public TInteger(String s) throws NumberFormatException {
|
||||
this(parseInt(s));
|
||||
}
|
||||
|
||||
|
@ -57,12 +57,12 @@ public class TInteger extends TNumber implements TComparable<TInteger> {
|
|||
return toString(i, 10);
|
||||
}
|
||||
|
||||
public static int parseInt(TString s, int radix) throws TNumberFormatException {
|
||||
public static int parseInt(String s, int radix) throws TNumberFormatException {
|
||||
if (radix < TCharacter.MIN_RADIX || radix > TCharacter.MAX_RADIX) {
|
||||
throw new TNumberFormatException(TString.wrap("Illegal radix: " + radix));
|
||||
throw new TNumberFormatException("Illegal radix: " + radix);
|
||||
}
|
||||
if (s == null || s.isEmpty()) {
|
||||
throw new TNumberFormatException(TString.wrap("String is null or empty"));
|
||||
throw new TNumberFormatException("String is null or empty");
|
||||
}
|
||||
boolean negative = false;
|
||||
int index = 0;
|
||||
|
@ -82,32 +82,32 @@ public class TInteger extends TNumber implements TComparable<TInteger> {
|
|||
while (index < s.length()) {
|
||||
int digit = TCharacter.getNumericValue(s.charAt(index++));
|
||||
if (digit < 0) {
|
||||
throw new TNumberFormatException(TString.wrap("String contains invalid digits: " + s));
|
||||
throw new TNumberFormatException("String contains invalid digits: " + s);
|
||||
}
|
||||
if (digit >= radix) {
|
||||
throw new TNumberFormatException(TString.wrap("String contains digits out of radix " + radix
|
||||
+ ": " + s));
|
||||
throw new TNumberFormatException("String contains digits out of radix " + radix
|
||||
+ ": " + s);
|
||||
}
|
||||
value = radix * value + digit;
|
||||
if (value < 0) {
|
||||
if (index == s.length() && value == MIN_VALUE && negative) {
|
||||
return MIN_VALUE;
|
||||
}
|
||||
throw new TNumberFormatException(TString.wrap("The value is too big for int type: " + s));
|
||||
throw new TNumberFormatException("The value is too big for int type: " + s);
|
||||
}
|
||||
}
|
||||
return negative ? -value : value;
|
||||
}
|
||||
|
||||
public static int parseInt(TString s) throws TNumberFormatException {
|
||||
public static int parseInt(String s) throws TNumberFormatException {
|
||||
return parseInt(s, 10);
|
||||
}
|
||||
|
||||
public static TInteger valueOf(TString s, int radix) throws TNumberFormatException {
|
||||
public static TInteger valueOf(String s, int radix) throws TNumberFormatException {
|
||||
return valueOf(parseInt(s, radix));
|
||||
}
|
||||
|
||||
public static TInteger valueOf(TString s) throws TNumberFormatException {
|
||||
public static TInteger valueOf(String s) throws TNumberFormatException {
|
||||
return valueOf(s, 10);
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ public class TInteger extends TNumber implements TComparable<TInteger> {
|
|||
}
|
||||
|
||||
public static TInteger getInteger(TString nm, TInteger val) {
|
||||
TString result = nm != null ? TString.wrap(TSystem.getProperty(nm.toString())) : null;
|
||||
String result = nm != null ? TSystem.getProperty(nm.toString()) : null;
|
||||
try {
|
||||
return result != null ? TInteger.valueOf(result) : val;
|
||||
} catch (NumberFormatException e) {
|
||||
|
@ -183,9 +183,9 @@ public class TInteger extends TNumber implements TComparable<TInteger> {
|
|||
}
|
||||
}
|
||||
|
||||
public static TInteger decode(TString nm) throws TNumberFormatException {
|
||||
public static TInteger decode(String nm) throws TNumberFormatException {
|
||||
if (nm == null || nm.isEmpty()) {
|
||||
throw new TNumberFormatException(TString.wrap("Can't parse empty or null string"));
|
||||
throw new TNumberFormatException("Can't parse empty or null string");
|
||||
}
|
||||
int index = 0;
|
||||
boolean negaive = false;
|
||||
|
@ -196,7 +196,7 @@ public class TInteger extends TNumber implements TComparable<TInteger> {
|
|||
negaive = true;
|
||||
}
|
||||
if (index >= nm.length()) {
|
||||
throw new TNumberFormatException(TString.wrap("The string does not represent a number"));
|
||||
throw new TNumberFormatException("The string does not represent a number");
|
||||
}
|
||||
int radix = 10;
|
||||
if (nm.charAt(index) == '#') {
|
||||
|
@ -215,20 +215,20 @@ public class TInteger extends TNumber implements TComparable<TInteger> {
|
|||
}
|
||||
}
|
||||
if (index >= nm.length()) {
|
||||
throw new TNumberFormatException(TString.wrap("The string does not represent a number"));
|
||||
throw new TNumberFormatException("The string does not represent a number");
|
||||
}
|
||||
int value = 0;
|
||||
while (index < nm.length()) {
|
||||
int digit = decodeDigit(nm.charAt(index++));
|
||||
if (digit >= radix) {
|
||||
throw new TNumberFormatException(TString.wrap("The string does not represent a number"));
|
||||
throw new TNumberFormatException("The string does not represent a number");
|
||||
}
|
||||
value = value * radix + digit;
|
||||
if (value < 0) {
|
||||
if (negaive && value == MIN_VALUE && index == nm.length()) {
|
||||
return TInteger.valueOf(MIN_VALUE);
|
||||
}
|
||||
throw new TNumberFormatException(TString.wrap("The string represents a too big number"));
|
||||
throw new TNumberFormatException("The string represents a too big number");
|
||||
}
|
||||
}
|
||||
return TInteger.valueOf(negaive ? -value : value);
|
||||
|
|
|
@ -20,11 +20,11 @@ public class TInternalError extends TVirtualMachineError {
|
|||
public TInternalError() {
|
||||
}
|
||||
|
||||
public TInternalError(TString message) {
|
||||
public TInternalError(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public TInternalError(TString message, TThrowable cause) {
|
||||
public TInternalError(String message, TThrowable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@ public class TLinkageError extends TError {
|
|||
super();
|
||||
}
|
||||
|
||||
public TLinkageError(TString message, TThrowable cause) {
|
||||
public TLinkageError(String message, TThrowable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TLinkageError(TString message) {
|
||||
public TLinkageError(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class TLong extends TNumber implements TComparable<TLong> {
|
|||
this.value = value;
|
||||
}
|
||||
|
||||
public TLong(TString value) throws TNumberFormatException {
|
||||
public TLong(String value) throws TNumberFormatException {
|
||||
this(parseLong(value));
|
||||
}
|
||||
|
||||
|
@ -37,12 +37,12 @@ public class TLong extends TNumber implements TComparable<TLong> {
|
|||
return new TLong(value);
|
||||
}
|
||||
|
||||
public static long parseLong(TString s, int radix) throws TNumberFormatException {
|
||||
public static long parseLong(String s, int radix) throws TNumberFormatException {
|
||||
if (radix < TCharacter.MIN_RADIX || radix > TCharacter.MAX_RADIX) {
|
||||
throw new TNumberFormatException(TString.wrap("Illegal radix: " + radix));
|
||||
throw new TNumberFormatException("Illegal radix: " + radix);
|
||||
}
|
||||
if (s == null || s.isEmpty()) {
|
||||
throw new TNumberFormatException(TString.wrap("String is null or empty"));
|
||||
throw new TNumberFormatException("String is null or empty");
|
||||
}
|
||||
boolean negative = false;
|
||||
int index = 0;
|
||||
|
@ -59,38 +59,38 @@ public class TLong extends TNumber implements TComparable<TLong> {
|
|||
while (index < s.length()) {
|
||||
int digit = TCharacter.getNumericValue(s.charAt(index++));
|
||||
if (digit < 0) {
|
||||
throw new TNumberFormatException(TString.wrap("String contains invalid digits: " + s));
|
||||
throw new TNumberFormatException("String contains invalid digits: " + s);
|
||||
}
|
||||
if (digit >= radix) {
|
||||
throw new TNumberFormatException(TString.wrap("String contains digits out of radix " + radix
|
||||
+ ": " + s));
|
||||
throw new TNumberFormatException("String contains digits out of radix " + radix
|
||||
+ ": " + s);
|
||||
}
|
||||
value = radix * value + digit;
|
||||
if (value < 0) {
|
||||
if (index == s.length() && value == MIN_VALUE && negative) {
|
||||
return MIN_VALUE;
|
||||
}
|
||||
throw new TNumberFormatException(TString.wrap("The value is too big for int type: " + s));
|
||||
throw new TNumberFormatException("The value is too big for int type: " + s);
|
||||
}
|
||||
}
|
||||
return negative ? -value : value;
|
||||
}
|
||||
|
||||
public static long parseLong(TString s) throws TNumberFormatException {
|
||||
public static long parseLong(String s) throws TNumberFormatException {
|
||||
return parseLong(s, 10);
|
||||
}
|
||||
|
||||
public static TLong valueOf(TString s, int radix) throws TNumberFormatException {
|
||||
public static TLong valueOf(String s, int radix) throws TNumberFormatException {
|
||||
return valueOf(parseLong(s, radix));
|
||||
}
|
||||
|
||||
public static TLong valueOf(TString s) throws TNumberFormatException {
|
||||
public static TLong valueOf(String s) throws TNumberFormatException {
|
||||
return valueOf(parseLong(s));
|
||||
}
|
||||
|
||||
public static TLong decode(TString nm) throws TNumberFormatException {
|
||||
if (nm == null || nm.isEmpty()) {
|
||||
throw new TNumberFormatException(TString.wrap("Can't parse empty or null string"));
|
||||
throw new TNumberFormatException("Can't parse empty or null string");
|
||||
}
|
||||
int index = 0;
|
||||
boolean negaive = false;
|
||||
|
@ -101,7 +101,7 @@ public class TLong extends TNumber implements TComparable<TLong> {
|
|||
negaive = true;
|
||||
}
|
||||
if (index >= nm.length()) {
|
||||
throw new TNumberFormatException(TString.wrap("The string does not represent a number"));
|
||||
throw new TNumberFormatException("The string does not represent a number");
|
||||
}
|
||||
int radix = 10;
|
||||
if (nm.charAt(index) == '#') {
|
||||
|
@ -120,20 +120,20 @@ public class TLong extends TNumber implements TComparable<TLong> {
|
|||
}
|
||||
}
|
||||
if (index >= nm.length()) {
|
||||
throw new TNumberFormatException(TString.wrap("The string does not represent a number"));
|
||||
throw new TNumberFormatException("The string does not represent a number");
|
||||
}
|
||||
long value = 0;
|
||||
while (index < nm.length()) {
|
||||
int digit = decodeDigit(nm.charAt(index++));
|
||||
if (digit >= radix) {
|
||||
throw new TNumberFormatException(TString.wrap("The string does not represent a number"));
|
||||
throw new TNumberFormatException("The string does not represent a number");
|
||||
}
|
||||
value = value * radix + digit;
|
||||
if (value < 0) {
|
||||
if (negaive && value == MIN_VALUE && index == nm.length()) {
|
||||
return TLong.valueOf(MIN_VALUE);
|
||||
}
|
||||
throw new TNumberFormatException(TString.wrap("The string represents a too big number"));
|
||||
throw new TNumberFormatException("The string represents a too big number");
|
||||
}
|
||||
}
|
||||
return TLong.valueOf(negaive ? -value : value);
|
||||
|
@ -219,16 +219,16 @@ public class TLong extends TNumber implements TComparable<TLong> {
|
|||
return compare(value, other.value);
|
||||
}
|
||||
|
||||
public static TLong getLong(TString nm) {
|
||||
public static TLong getLong(String nm) {
|
||||
return getLong(nm, null);
|
||||
}
|
||||
|
||||
public static TLong getLong(TString nm, long val) {
|
||||
public static TLong getLong(String nm, long val) {
|
||||
return getLong(nm, TLong.valueOf(val));
|
||||
}
|
||||
|
||||
public static TLong getLong(TString nm, TLong val) {
|
||||
TString result = nm != null ? TString.wrap(TSystem.getProperty(nm.toString())) : null;
|
||||
public static TLong getLong(String nm, TLong val) {
|
||||
String result = nm != null ? TSystem.getProperty(nm) : null;
|
||||
try {
|
||||
return result != null ? TLong.valueOf(result) : val;
|
||||
} catch (NumberFormatException e) {
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TNegativeArraySizeException extends TRuntimeException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TNegativeArraySizeException(TString message) {
|
||||
public TNegativeArraySizeException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TNoClassDefFoundError extends TLinkageError {
|
|||
super();
|
||||
}
|
||||
|
||||
public TNoClassDefFoundError(TString message) {
|
||||
public TNoClassDefFoundError(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TNoSuchFieldError extends TIncompatibleClassChangeError {
|
|||
super();
|
||||
}
|
||||
|
||||
public TNoSuchFieldError(TString message) {
|
||||
public TNoSuchFieldError(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TNoSuchMethodError extends TIncompatibleClassChangeError {
|
|||
super();
|
||||
}
|
||||
|
||||
public TNoSuchMethodError(TString message) {
|
||||
public TNoSuchMethodError(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class TNoSuchMethodException extends TReflectiveOperationException {
|
|||
public TNoSuchMethodException() {
|
||||
}
|
||||
|
||||
public TNoSuchMethodException(TString message) {
|
||||
public TNoSuchMethodException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.teavm.classlib.java.lang;
|
|||
public class TNullPointerException extends TRuntimeException {
|
||||
private static final long serialVersionUID = 2639861320773057190L;
|
||||
|
||||
public TNullPointerException(TString message) {
|
||||
public TNullPointerException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TNumberFormatException extends TIllegalArgumentException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TNumberFormatException(TString message) {
|
||||
public TNumberFormatException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.teavm.interop.Rename;
|
|||
import org.teavm.interop.Structure;
|
||||
import org.teavm.interop.Superclass;
|
||||
import org.teavm.interop.Sync;
|
||||
import org.teavm.interop.Unmanaged;
|
||||
import org.teavm.jso.browser.TimerHandler;
|
||||
import org.teavm.platform.Platform;
|
||||
import org.teavm.platform.PlatformObject;
|
||||
|
@ -392,9 +391,4 @@ public class TObject {
|
|||
@Override
|
||||
protected void finalize() throws TThrowable {
|
||||
}
|
||||
|
||||
@Unmanaged
|
||||
public static TObject wrap(Object obj) {
|
||||
return (TObject) obj;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TOutOfMemoryError extends TVirtualMachineError {
|
|||
super();
|
||||
}
|
||||
|
||||
public TOutOfMemoryError(TString message) {
|
||||
public TOutOfMemoryError(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,11 +22,11 @@ public class TReflectiveOperationException extends TException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TReflectiveOperationException(TString message, TThrowable cause) {
|
||||
public TReflectiveOperationException(String message, TThrowable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TReflectiveOperationException(TString message) {
|
||||
public TReflectiveOperationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@ public class TRuntimeException extends TException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TRuntimeException(TString message, TThrowable cause) {
|
||||
public TRuntimeException(String message, TThrowable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TRuntimeException(TString message) {
|
||||
public TRuntimeException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@ public class TSecurityException extends TRuntimeException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TSecurityException(TString message, TThrowable cause) {
|
||||
public TSecurityException(String message, TThrowable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TSecurityException(TString message) {
|
||||
public TSecurityException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public class TShort extends TNumber implements TComparable<TShort> {
|
|||
this.value = value;
|
||||
}
|
||||
|
||||
public TShort(TString s) throws TNumberFormatException {
|
||||
public TShort(String s) throws TNumberFormatException {
|
||||
this(parseShort(s));
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class TShort extends TNumber implements TComparable<TShort> {
|
|||
return compare(value, other.value);
|
||||
}
|
||||
|
||||
public static short parseShort(TString s, int radix) throws TNumberFormatException {
|
||||
public static short parseShort(String s, int radix) throws TNumberFormatException {
|
||||
int value = TInteger.parseInt(s, radix);
|
||||
if (value < MIN_VALUE || value > MAX_VALUE) {
|
||||
throw new TNumberFormatException();
|
||||
|
@ -95,19 +95,19 @@ public class TShort extends TNumber implements TComparable<TShort> {
|
|||
return (short) value;
|
||||
}
|
||||
|
||||
public static short parseShort(TString s) throws TNumberFormatException {
|
||||
public static short parseShort(String s) throws TNumberFormatException {
|
||||
return parseShort(s, 10);
|
||||
}
|
||||
|
||||
public static TShort valueOf(TString s, int radix) throws TNumberFormatException {
|
||||
public static TShort valueOf(String s, int radix) throws TNumberFormatException {
|
||||
return valueOf(parseShort(s, radix));
|
||||
}
|
||||
|
||||
public static TShort valueOf(TString s) throws TNumberFormatException {
|
||||
public static TShort valueOf(String s) throws TNumberFormatException {
|
||||
return valueOf(parseShort(s));
|
||||
}
|
||||
|
||||
public static TShort decode(TString s) throws TNumberFormatException {
|
||||
public static TShort decode(String s) throws TNumberFormatException {
|
||||
int value = TInteger.decode(s).intValue();
|
||||
if (value < MIN_VALUE || value > MAX_VALUE) {
|
||||
throw new TNumberFormatException();
|
||||
|
|
|
@ -31,17 +31,13 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.lang;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sergey Kapralov
|
||||
*/
|
||||
public class TStackOverflowError extends TVirtualMachineError {
|
||||
|
||||
public TStackOverflowError() {
|
||||
super();
|
||||
}
|
||||
|
||||
public TStackOverflowError(TString string) {
|
||||
public TStackOverflowError(String string) {
|
||||
super(string);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,12 +20,12 @@ import org.teavm.classlib.java.io.TSerializable;
|
|||
import org.teavm.classlib.java.util.TObjects;
|
||||
|
||||
public final class TStackTraceElement extends TObject implements TSerializable {
|
||||
private TString declaringClass;
|
||||
private TString methodName;
|
||||
private TString fileName;
|
||||
private String declaringClass;
|
||||
private String methodName;
|
||||
private String fileName;
|
||||
private int lineNumber;
|
||||
|
||||
public TStackTraceElement(TString declaringClass, TString methodName, TString fileName, int lineNumber) {
|
||||
public TStackTraceElement(String declaringClass, String methodName, String fileName, int lineNumber) {
|
||||
if (declaringClass == null || methodName == null) {
|
||||
throw new TNullPointerException();
|
||||
}
|
||||
|
@ -35,15 +35,15 @@ public final class TStackTraceElement extends TObject implements TSerializable {
|
|||
this.lineNumber = lineNumber;
|
||||
}
|
||||
|
||||
public TString getClassName() {
|
||||
public String getClassName() {
|
||||
return declaringClass;
|
||||
}
|
||||
|
||||
public TString getMethodName() {
|
||||
public String getMethodName() {
|
||||
return methodName;
|
||||
}
|
||||
|
||||
public TString getFileName() {
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
|
@ -77,15 +77,15 @@ public final class TStackTraceElement extends TObject implements TSerializable {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
TStringBuilder sb = new TStringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int index = declaringClass.lastIndexOf('.');
|
||||
sb.append(declaringClass.substring(index + 1)).append('.').append(methodName).append('(');
|
||||
if (fileName != null) {
|
||||
sb.append(fileName).append(':').append(lineNumber);
|
||||
} else {
|
||||
sb.append(TString.wrap("Unknown Source"));
|
||||
sb.append("Unknown Source");
|
||||
}
|
||||
sb.append(TString.wrap(")"));
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.teavm.classlib.java.util.THashMap;
|
|||
import org.teavm.classlib.java.util.TLocale;
|
||||
import org.teavm.classlib.java.util.TMap;
|
||||
import org.teavm.classlib.java.util.regex.TPattern;
|
||||
import org.teavm.interop.Unmanaged;
|
||||
|
||||
public class TString extends TObject implements TSerializable, TComparable<TString>, TCharSequence {
|
||||
public static final TComparator<TString> CASE_INSENSITIVE_ORDER = (o1, o2) -> o1.compareToIgnoreCase(o2);
|
||||
|
@ -425,8 +424,8 @@ public class TString extends TObject implements TSerializable, TComparable<TStri
|
|||
return false;
|
||||
}
|
||||
|
||||
public TString replace(TCharSequence target, TCharSequence replacement) {
|
||||
TStringBuilder sb = new TStringBuilder();
|
||||
public String replace(TCharSequence target, TCharSequence replacement) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int sz = length() - target.length();
|
||||
int i = 0;
|
||||
outer:
|
||||
|
@ -441,7 +440,7 @@ public class TString extends TObject implements TSerializable, TComparable<TStri
|
|||
i += target.length() - 1;
|
||||
}
|
||||
sb.append(substring(i));
|
||||
return TString.wrap(sb.toString());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public TString trim() {
|
||||
|
@ -469,8 +468,8 @@ public class TString extends TObject implements TSerializable, TComparable<TStri
|
|||
return array;
|
||||
}
|
||||
|
||||
public static TString valueOf(TObject obj) {
|
||||
return obj != null ? TString.wrap(obj.toString()) : TString.wrap("null");
|
||||
public static String valueOf(Object obj) {
|
||||
return obj != null ? obj.toString() : "null";
|
||||
}
|
||||
|
||||
public static TString valueOf(char[] data) {
|
||||
|
@ -489,28 +488,28 @@ public class TString extends TObject implements TSerializable, TComparable<TStri
|
|||
return valueOf(data, offset, count);
|
||||
}
|
||||
|
||||
public static TString valueOf(boolean b) {
|
||||
return b ? TString.wrap("true") : TString.wrap("false");
|
||||
public static String valueOf(boolean b) {
|
||||
return b ? "true" : "false";
|
||||
}
|
||||
|
||||
public static TString valueOf(char c) {
|
||||
return new TString(new char[] { c });
|
||||
public static String valueOf(char c) {
|
||||
return new String(new char[] { c });
|
||||
}
|
||||
|
||||
public static TString valueOf(int i) {
|
||||
return TString.wrap(new TStringBuilder().append(i).toString());
|
||||
public static String valueOf(int i) {
|
||||
return new TStringBuilder().append(i).toString();
|
||||
}
|
||||
|
||||
public static TString valueOf(long l) {
|
||||
return TString.wrap(new TStringBuilder().append(l).toString());
|
||||
public static String valueOf(long l) {
|
||||
return new TStringBuilder().append(l).toString();
|
||||
}
|
||||
|
||||
public static TString valueOf(float f) {
|
||||
return TString.wrap(new TStringBuilder().append(f).toString());
|
||||
public static String valueOf(float f) {
|
||||
return new TStringBuilder().append(f).toString();
|
||||
}
|
||||
|
||||
public static TString valueOf(double d) {
|
||||
return TString.wrap(new TStringBuilder().append(d).toString());
|
||||
public static String valueOf(double d) {
|
||||
return new TStringBuilder().append(d).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -580,11 +579,6 @@ public class TString extends TObject implements TSerializable, TComparable<TStri
|
|||
return hashCode;
|
||||
}
|
||||
|
||||
@Unmanaged
|
||||
public static TString wrap(String str) {
|
||||
return (TString) (Object) str;
|
||||
}
|
||||
|
||||
public TString toLowerCase() {
|
||||
if (isEmpty()) {
|
||||
return this;
|
||||
|
|
|
@ -33,7 +33,7 @@ public class TStringBuffer extends TAbstractStringBuilder implements TAppendable
|
|||
}
|
||||
|
||||
@Override
|
||||
public TStringBuffer append(TString string) {
|
||||
public TStringBuffer append(String string) {
|
||||
super.append(string);
|
||||
return this;
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ public class TStringBuffer extends TAbstractStringBuilder implements TAppendable
|
|||
}
|
||||
|
||||
@Override
|
||||
public TStringBuffer insert(int index, TString string) {
|
||||
public TStringBuffer insert(int index, String string) {
|
||||
super.insert(index, string);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public class TStringBuilder extends TAbstractStringBuilder implements TAppendabl
|
|||
}
|
||||
|
||||
@Override
|
||||
public TStringBuilder append(TString string) {
|
||||
public TStringBuilder append(String string) {
|
||||
super.append(string);
|
||||
return this;
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ public class TStringBuilder extends TAbstractStringBuilder implements TAppendabl
|
|||
}
|
||||
|
||||
@Override
|
||||
public TStringBuilder insert(int index, TString string) {
|
||||
public TStringBuilder insert(int index, String string) {
|
||||
super.insert(index, string);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -22,12 +22,11 @@ public class TStringIndexOutOfBoundsException extends TIndexOutOfBoundsException
|
|||
super();
|
||||
}
|
||||
|
||||
public TStringIndexOutOfBoundsException(TString message) {
|
||||
public TStringIndexOutOfBoundsException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public TStringIndexOutOfBoundsException(int index) {
|
||||
super(TString.wrap(new TStringBuilder().append(TString.wrap("String index out of bounds: "))
|
||||
.append(index).toString()));
|
||||
super(new TStringBuilder().append("String index out of bounds: ").append(index).toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public final class TSystem extends TObject {
|
|||
|
||||
public static void arraycopy(TObject src, int srcPos, TObject dest, int destPos, int length) {
|
||||
if (src == null || dest == null) {
|
||||
throw new TNullPointerException(TString.wrap("Either src or dest is null"));
|
||||
throw new TNullPointerException("Either src or dest is null");
|
||||
}
|
||||
if (srcPos < 0 || destPos < 0 || length < 0 || srcPos + length > TArray.getLength(src)
|
||||
|| destPos + length > TArray.getLength(dest)) {
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.teavm.platform.PlatformRunnable;
|
|||
import org.teavm.platform.async.AsyncCallback;
|
||||
|
||||
public class TThread extends TObject implements TRunnable {
|
||||
private static TThread mainThread = new TThread(TString.wrap("main"));
|
||||
private static TThread mainThread = new TThread("main");
|
||||
private static TThread currentThread = mainThread;
|
||||
private static long nextId = 1;
|
||||
private static int activeCount = 1;
|
||||
|
@ -33,7 +33,7 @@ public class TThread extends TObject implements TRunnable {
|
|||
private boolean interruptedFlag;
|
||||
public TThreadInterruptHandler interruptHandler;
|
||||
|
||||
private TString name;
|
||||
private String name;
|
||||
private boolean alive = true;
|
||||
TRunnable target;
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class TThread extends TObject implements TRunnable {
|
|||
this(null, null);
|
||||
}
|
||||
|
||||
public TThread(TString name) {
|
||||
public TThread(String name) {
|
||||
this(null, name);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class TThread extends TObject implements TRunnable {
|
|||
this(target, null);
|
||||
}
|
||||
|
||||
public TThread(TRunnable target, TString name) {
|
||||
public TThread(TRunnable target, String name) {
|
||||
this.name = name;
|
||||
this.target = target;
|
||||
id = nextId++;
|
||||
|
@ -94,7 +94,7 @@ public class TThread extends TObject implements TRunnable {
|
|||
return currentThread;
|
||||
}
|
||||
|
||||
public TString getName() {
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.lang;
|
||||
|
||||
import org.teavm.classlib.java.io.TPrintStream;
|
||||
import org.teavm.classlib.java.io.TPrintWriter;
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
import org.teavm.classlib.java.util.TArrays;
|
||||
import org.teavm.interop.DelegateTo;
|
||||
import org.teavm.interop.Remove;
|
||||
|
@ -27,7 +27,7 @@ import org.teavm.runtime.ExceptionHandling;
|
|||
@Superclass("java.lang.Object")
|
||||
public class TThrowable extends RuntimeException {
|
||||
private static final long serialVersionUID = 2026791432677149320L;
|
||||
private TString message;
|
||||
private String message;
|
||||
private TThrowable cause;
|
||||
private boolean suppressionEnabled;
|
||||
private boolean writableStackTrace;
|
||||
|
@ -36,11 +36,11 @@ public class TThrowable extends RuntimeException {
|
|||
|
||||
@SuppressWarnings("unused")
|
||||
@Rename("fakeInit")
|
||||
protected TThrowable(TString message, TThrowable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
protected TThrowable(String message, TThrowable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
}
|
||||
|
||||
@Rename("<init>")
|
||||
public void init(TString message, TThrowable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
public void init(String message, TThrowable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
if (writableStackTrace) {
|
||||
fillInStackTrace();
|
||||
}
|
||||
|
@ -62,11 +62,11 @@ public class TThrowable extends RuntimeException {
|
|||
}
|
||||
|
||||
@Rename("fakeInit")
|
||||
public TThrowable(@SuppressWarnings("unused") TString message) {
|
||||
public TThrowable(@SuppressWarnings("unused") String message) {
|
||||
}
|
||||
|
||||
@Rename("<init>")
|
||||
private void init(TString message) {
|
||||
private void init(String message) {
|
||||
this.suppressionEnabled = true;
|
||||
this.writableStackTrace = true;
|
||||
fillInStackTrace();
|
||||
|
@ -75,11 +75,11 @@ public class TThrowable extends RuntimeException {
|
|||
|
||||
@SuppressWarnings("unused")
|
||||
@Rename("fakeInit")
|
||||
public TThrowable(TString message, TThrowable cause) {
|
||||
public TThrowable(String message, TThrowable cause) {
|
||||
}
|
||||
|
||||
@Rename("<init>")
|
||||
private void init(TString message, TThrowable cause) {
|
||||
private void init(String message, TThrowable cause) {
|
||||
this.suppressionEnabled = true;
|
||||
this.writableStackTrace = true;
|
||||
fillInStackTrace();
|
||||
|
@ -114,13 +114,13 @@ public class TThrowable extends RuntimeException {
|
|||
}
|
||||
|
||||
@Rename("getMessage")
|
||||
public TString getMessage0() {
|
||||
public String getMessage0() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@Rename("getLocalizedMessage")
|
||||
public TString getLocalizedMessage0() {
|
||||
return TString.wrap(getMessage());
|
||||
public String getLocalizedMessage0() {
|
||||
return getMessage();
|
||||
}
|
||||
|
||||
@Remove
|
||||
|
@ -132,17 +132,17 @@ public class TThrowable extends RuntimeException {
|
|||
}
|
||||
|
||||
@Remove
|
||||
public native TClass<?> getClass0();
|
||||
public native Class<?> getClass0();
|
||||
|
||||
@Remove
|
||||
public native TString toString0();
|
||||
public native String toString0();
|
||||
|
||||
public TThrowable initCause(TThrowable cause) {
|
||||
if (this.cause != this && this.cause != null) {
|
||||
throw new TIllegalStateException(TString.wrap("Cause already set"));
|
||||
throw new IllegalStateException("Cause already set");
|
||||
}
|
||||
if (cause == this) {
|
||||
throw new TIllegalArgumentException(TString.wrap("Circular causation relation"));
|
||||
throw new IllegalArgumentException("Circular causation relation");
|
||||
}
|
||||
this.cause = cause;
|
||||
return this;
|
||||
|
@ -150,38 +150,38 @@ public class TThrowable extends RuntimeException {
|
|||
|
||||
@Override
|
||||
public void printStackTrace() {
|
||||
printStackTrace(TSystem.err());
|
||||
printStackTrace(System.err);
|
||||
}
|
||||
|
||||
public void printStackTrace(TPrintStream stream) {
|
||||
stream.print(TString.wrap(getClass().getName()));
|
||||
public void printStackTrace(PrintStream stream) {
|
||||
stream.print(getClass().getName());
|
||||
String message = getMessage();
|
||||
if (message != null) {
|
||||
stream.print(TString.wrap(": " + getMessage()));
|
||||
stream.print(": " + getMessage());
|
||||
}
|
||||
stream.println();
|
||||
if (stackTrace != null) {
|
||||
for (TStackTraceElement element : stackTrace) {
|
||||
stream.print(TString.wrap(" at "));
|
||||
stream.print(" at ");
|
||||
stream.println(element);
|
||||
}
|
||||
}
|
||||
if (cause != null && cause != this) {
|
||||
stream.print(TString.wrap("Caused by: "));
|
||||
stream.print("Caused by: ");
|
||||
cause.printStackTrace(stream);
|
||||
}
|
||||
}
|
||||
|
||||
public void printStackTrace(TPrintWriter stream) {
|
||||
stream.println(TString.wrap(getClass().getName() + ": " + getMessage()));
|
||||
public void printStackTrace(PrintWriter stream) {
|
||||
stream.println(getClass().getName() + ": " + getMessage());
|
||||
if (stackTrace != null) {
|
||||
for (TStackTraceElement element : stackTrace) {
|
||||
stream.print(TString.wrap(" at "));
|
||||
stream.print(" at ");
|
||||
stream.println(element);
|
||||
}
|
||||
}
|
||||
if (cause != null && cause != this) {
|
||||
stream.print(TString.wrap("Caused by: "));
|
||||
stream.print("Caused by: ");
|
||||
cause.printStackTrace(stream);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,11 +22,11 @@ public class TUnsupportedOperationException extends TRuntimeException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TUnsupportedOperationException(TString message, TThrowable cause) {
|
||||
public TUnsupportedOperationException(String message, TThrowable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TUnsupportedOperationException(TString message) {
|
||||
public TUnsupportedOperationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public class TVirtualMachineError extends TError {
|
|||
super();
|
||||
}
|
||||
|
||||
public TVirtualMachineError(TString message) {
|
||||
public TVirtualMachineError(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ public class TVirtualMachineError extends TError {
|
|||
super(cause);
|
||||
}
|
||||
|
||||
public TVirtualMachineError(TString message, TThrowable cause) {
|
||||
public TVirtualMachineError(String message, TThrowable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public interface TAnnotatedElement {
|
|||
|
||||
TAnnotation[] getDeclaredAnnotations();
|
||||
|
||||
default <T extends TAnnotation> T[] getAnnotationsByType(TClass<T> annotationClass) {
|
||||
default <T extends TAnnotation> T[] getAnnotationsByType(Class<T> annotationClass) {
|
||||
List<T> result = new ArrayList<>();
|
||||
Object classAsObject = annotationClass;
|
||||
for (TAnnotation annot : getAnnotations()) {
|
||||
|
@ -55,7 +55,7 @@ public interface TAnnotatedElement {
|
|||
return null;
|
||||
}
|
||||
|
||||
default <T extends TAnnotation> T[] getDeclaredAnnotationsByType(TClass<T> annotationClass) {
|
||||
default <T extends TAnnotation> T[] getDeclaredAnnotationsByType(Class<T> annotationClass) {
|
||||
List<T> result = new ArrayList<>();
|
||||
Object classAsObject = annotationClass;
|
||||
for (TAnnotation annot : getDeclaredAnnotations()) {
|
||||
|
|
|
@ -48,17 +48,17 @@ public final class TArray extends TObject {
|
|||
}
|
||||
|
||||
@PluggableDependency(ArrayNativeGenerator.class)
|
||||
public static TObject newInstance(TClass<?> componentType, int length) throws TNegativeArraySizeException {
|
||||
public static TObject newInstance(Class<?> componentType, int length) throws TNegativeArraySizeException {
|
||||
if (componentType == null) {
|
||||
throw new TNullPointerException();
|
||||
}
|
||||
if (componentType == TClass.wrap(void.class)) {
|
||||
if (componentType == void.class) {
|
||||
throw new TIllegalArgumentException();
|
||||
}
|
||||
if (length < 0) {
|
||||
throw new TNegativeArraySizeException();
|
||||
}
|
||||
return newInstanceImpl(componentType.getPlatformClass(), length);
|
||||
return newInstanceImpl(((TClass<?>) (Object) componentType).getPlatformClass(), length);
|
||||
}
|
||||
|
||||
@GeneratedBy(ArrayNativeGenerator.class)
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
package org.teavm.classlib.java.lang.reflect;
|
||||
|
||||
import org.teavm.classlib.java.lang.TReflectiveOperationException;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import org.teavm.classlib.java.lang.TThrowable;
|
||||
|
||||
public class TInvocationTargetException extends TReflectiveOperationException {
|
||||
|
@ -27,7 +26,7 @@ public class TInvocationTargetException extends TReflectiveOperationException {
|
|||
super(null, target);
|
||||
}
|
||||
|
||||
public TInvocationTargetException(TThrowable target, TString s) {
|
||||
public TInvocationTargetException(TThrowable target, String s) {
|
||||
super(s, target);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,44 +21,24 @@ import org.teavm.classlib.java.lang.TIllegalArgumentException;
|
|||
import org.teavm.classlib.java.lang.TString;
|
||||
import org.teavm.classlib.java.lang.TStringBuilder;
|
||||
|
||||
/**
|
||||
* This class is used to encode a string using the format required by {@code
|
||||
* application/x-www-form-urlencoded} MIME content type. It contains helper
|
||||
* methods used by the URI class, and performs encoding and decoding in a
|
||||
* slightly different way than {@code URLEncoder} and {@code URLDecoder}.
|
||||
*/
|
||||
class TURIEncoderDecoder {
|
||||
static final TString digits = TString.wrap("0123456789ABCDEF");
|
||||
static final String digits = "0123456789ABCDEF";
|
||||
|
||||
private TURIEncoderDecoder() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a string by checking if it contains any characters other than:
|
||||
* 1. letters ('a'..'z', 'A'..'Z') 2. numbers ('0'..'9') 3. characters in
|
||||
* the legalset parameter 4. others (unicode characters that are not in
|
||||
* US-ASCII set, and are not ISO Control or are not ISO Space characters)
|
||||
* <p>
|
||||
* called from {@code URI.Helper.parseURI()} to validate each component
|
||||
*
|
||||
* @param s
|
||||
* {@code java.lang.String} the string to be validated
|
||||
* @param legal
|
||||
* {@code java.lang.String} the characters allowed in the String
|
||||
* s
|
||||
*/
|
||||
static void validate(TString s, TString legal) throws TURISyntaxException {
|
||||
static void validate(String s, String legal) throws TURISyntaxException {
|
||||
for (int i = 0; i < s.length();) {
|
||||
char ch = s.charAt(i);
|
||||
if (ch == '%') {
|
||||
do {
|
||||
if (i + 2 >= s.length()) {
|
||||
throw new TURISyntaxException(s, TString.wrap(""), i);
|
||||
throw new TURISyntaxException(s, "", i);
|
||||
}
|
||||
int d1 = TCharacter.digit(s.charAt(i + 1), 16);
|
||||
int d2 = TCharacter.digit(s.charAt(i + 2), 16);
|
||||
if (d1 == -1 || d2 == -1) {
|
||||
throw new TURISyntaxException(s, TString.wrap(""), i);
|
||||
throw new TURISyntaxException(s, "", i);
|
||||
}
|
||||
|
||||
i += 3;
|
||||
|
@ -69,7 +49,7 @@ class TURIEncoderDecoder {
|
|||
if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')
|
||||
|| (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1 || (ch > 127
|
||||
&& !isSpaceChar(ch) && !TCharacter.isISOControl(ch)))) {
|
||||
throw new TURISyntaxException(s, TString.wrap(""), i); //$NON-NLS-1$
|
||||
throw new TURISyntaxException(s, "", i);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
@ -85,38 +65,19 @@ class TURIEncoderDecoder {
|
|||
}
|
||||
}
|
||||
|
||||
static void validateSimple(TString s, TString legal)
|
||||
static void validateSimple(String s, String legal)
|
||||
throws TURISyntaxException {
|
||||
for (int i = 0; i < s.length();) {
|
||||
char ch = s.charAt(i);
|
||||
if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')
|
||||
|| (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1)) {
|
||||
throw new TURISyntaxException(s, TString.wrap(""), i); //$NON-NLS-1$
|
||||
throw new TURISyntaxException(s, "", i);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* All characters except letters ('a'..'z', 'A'..'Z') and numbers ('0'..'9')
|
||||
* and legal characters are converted into their hexidecimal value prepended
|
||||
* by '%'.
|
||||
* <p>
|
||||
* For example: '#' -> %23
|
||||
* Other characters, which are unicode chars that are not US-ASCII, and are
|
||||
* not ISO Control or are not ISO Space chars, are preserved.
|
||||
* <p>
|
||||
* Called from {@code URI.quoteComponent()} (for multiple argument
|
||||
* constructors)
|
||||
*
|
||||
* @param s
|
||||
* java.lang.String the string to be converted
|
||||
* @param legal
|
||||
* java.lang.String the characters allowed to be preserved in the
|
||||
* string s
|
||||
* @return java.lang.String the converted string
|
||||
*/
|
||||
static TString quoteIllegal(TString s, TString legal) {
|
||||
static String quoteIllegal(String s, String legal) {
|
||||
TStringBuilder buf = new TStringBuilder();
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char ch = s.charAt(i);
|
||||
|
@ -135,23 +96,10 @@ class TURIEncoderDecoder {
|
|||
}
|
||||
}
|
||||
}
|
||||
return TString.wrap(buf.toString());
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Other characters, which are Unicode chars that are not US-ASCII, and are
|
||||
* not ISO Control or are not ISO Space chars are not preserved. They are
|
||||
* converted into their hexidecimal value prepended by '%'.
|
||||
* <p>
|
||||
* For example: Euro currency symbol -> "%E2%82%AC".
|
||||
* <p>
|
||||
* Called from URI.toASCIIString()
|
||||
*
|
||||
* @param s
|
||||
* java.lang.String the string to be converted
|
||||
* @return java.lang.String the converted string
|
||||
*/
|
||||
static TString encodeOthers(TString s) {
|
||||
static String encodeOthers(String s) {
|
||||
TStringBuilder buf = new TStringBuilder();
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char ch = s.charAt(i);
|
||||
|
@ -166,27 +114,10 @@ class TURIEncoderDecoder {
|
|||
}
|
||||
}
|
||||
}
|
||||
return TString.wrap(buf.toString());
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes the string argument which is assumed to be encoded in the {@code
|
||||
* x-www-form-urlencoded} MIME content type using the UTF-8 encoding scheme.
|
||||
* <p>
|
||||
*'%' and two following hex digit characters are converted to the
|
||||
* equivalent byte value. All other characters are passed through
|
||||
* unmodified.
|
||||
* <p>
|
||||
* e.g. "A%20B%20C %24%25" -> "A B C $%"
|
||||
* <p>
|
||||
* Called from URI.getXYZ() methods
|
||||
*
|
||||
* @param s
|
||||
* java.lang.String The encoded string.
|
||||
* @return java.lang.String The decoded version.
|
||||
*/
|
||||
static TString decode(TString s) {
|
||||
|
||||
static String decode(String s) {
|
||||
TStringBuilder result = new TStringBuilder();
|
||||
TByteArrayOutputStream out = new TByteArrayOutputStream();
|
||||
for (int i = 0; i < s.length();) {
|
||||
|
@ -205,13 +136,13 @@ class TURIEncoderDecoder {
|
|||
out.write((byte) ((d1 << 4) + d2));
|
||||
i += 3;
|
||||
} while (i < s.length() && s.charAt(i) == '%');
|
||||
result.append(TString.wrap(out.toString()));
|
||||
result.append(out.toString());
|
||||
continue;
|
||||
}
|
||||
result.append(c);
|
||||
i++;
|
||||
}
|
||||
return TString.wrap(result.toString());
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,39 +18,13 @@ package org.teavm.classlib.java.net;
|
|||
import org.teavm.classlib.java.lang.TException;
|
||||
import org.teavm.classlib.java.lang.TIllegalArgumentException;
|
||||
import org.teavm.classlib.java.lang.TNullPointerException;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import org.teavm.interop.Rename;
|
||||
|
||||
/**
|
||||
* A {@code URISyntaxException} will be thrown if some information could not be parsed
|
||||
* while creating a URI.
|
||||
*/
|
||||
public class TURISyntaxException extends TException {
|
||||
|
||||
private static final long serialVersionUID = 2137979680897488891L;
|
||||
|
||||
private TString input;
|
||||
|
||||
private String input;
|
||||
private int index;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code URISyntaxException} instance containing the
|
||||
* string that caused the exception, a description of the problem and the
|
||||
* index at which the error occurred.
|
||||
*
|
||||
* @param input
|
||||
* the string that caused the exception.
|
||||
* @param reason
|
||||
* the reason why the exception occurred.
|
||||
* @param index
|
||||
* the position where the exception occurred.
|
||||
* @throws NullPointerException
|
||||
* if one of the arguments {@code input} or {@code reason} is
|
||||
* {@code null}.
|
||||
* @throws IllegalArgumentException
|
||||
* if the value for {@code index} is lesser than {@code -1}.
|
||||
*/
|
||||
public TURISyntaxException(TString input, TString reason, int index) {
|
||||
public TURISyntaxException(String input, String reason, int index) {
|
||||
super(reason);
|
||||
|
||||
if (input == null || reason == null) {
|
||||
|
@ -65,19 +39,7 @@ public class TURISyntaxException extends TException {
|
|||
this.index = index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code URISyntaxException} instance containing the
|
||||
* string that caused the exception and a description of the problem.
|
||||
*
|
||||
*@param input
|
||||
* the string that caused the exception.
|
||||
* @param reason
|
||||
* the reason why the exception occurred.
|
||||
* @throws NullPointerException
|
||||
* if one of the arguments {@code input} or {@code reason} is
|
||||
* {@code null}.
|
||||
*/
|
||||
public TURISyntaxException(TString input, TString reason) {
|
||||
public TURISyntaxException(String input, String reason) {
|
||||
super(reason);
|
||||
|
||||
if (input == null || reason == null) {
|
||||
|
@ -88,45 +50,21 @@ public class TURISyntaxException extends TException {
|
|||
index = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the index at which the syntax error was found or {@code -1} if the
|
||||
* index is unknown/unavailable.
|
||||
*
|
||||
* @return the index of the syntax error.
|
||||
*/
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a description of the syntax error.
|
||||
*
|
||||
* @return the string describing the syntax error.
|
||||
*/
|
||||
public TString getReason() {
|
||||
return TString.wrap(super.getMessage());
|
||||
public String getReason() {
|
||||
return super.getMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the initial string that contains an invalid syntax.
|
||||
*
|
||||
* @return the string that caused the exception.
|
||||
*/
|
||||
public TString getInput() {
|
||||
public String getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a description of the exception, including the reason, the string
|
||||
* that caused the syntax error and the position of the syntax error if
|
||||
* available.
|
||||
*
|
||||
* @return a sting containing information about the exception.
|
||||
* @see java.lang.Throwable#getMessage()
|
||||
*/
|
||||
@Override
|
||||
@Rename("getMessage")
|
||||
public TString getMessage0() {
|
||||
return TString.wrap("");
|
||||
public String getMessage0() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.io.Serializable;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import org.teavm.classlib.java.net.impl.TDummyStreamHandler;
|
||||
import org.teavm.classlib.java.net.impl.TXHRStreamHandler;
|
||||
|
||||
|
@ -316,7 +315,7 @@ public final class TURL implements Serializable {
|
|||
}
|
||||
|
||||
public TURI toURI() throws TURISyntaxException {
|
||||
return new TURI((TString) (Object) toExternalForm());
|
||||
return new TURI(toExternalForm());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,18 +16,17 @@
|
|||
package org.teavm.classlib.java.security;
|
||||
|
||||
import org.teavm.classlib.java.lang.TSecurityException;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
|
||||
public class TAccessControlException extends TSecurityException {
|
||||
private static final long serialVersionUID = 8282514874369266797L;
|
||||
private TPermission permission;
|
||||
|
||||
public TAccessControlException(TString message) {
|
||||
public TAccessControlException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public TAccessControlException(String s, TPermission permission) {
|
||||
super((TString) (Object) s);
|
||||
super(s);
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,11 +19,9 @@ import java.math.BigDecimal;
|
|||
import java.math.BigInteger;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.teavm.classlib.impl.unicode.CLDRHelper;
|
||||
import org.teavm.classlib.java.lang.TArithmeticException;
|
||||
import org.teavm.classlib.java.lang.TDouble;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import org.teavm.classlib.java.util.TLocale;
|
||||
|
||||
public class TDecimalFormat extends TNumberFormat {
|
||||
|
@ -984,7 +982,7 @@ public class TDecimalFormat extends TNumberFormat {
|
|||
break;
|
||||
case UNNECESSARY:
|
||||
if (mantissa % rounding != 0) {
|
||||
throw new TArithmeticException(TString.wrap("Can't avoid rounding"));
|
||||
throw new TArithmeticException("Can't avoid rounding");
|
||||
}
|
||||
break;
|
||||
case HALF_DOWN:
|
||||
|
@ -1040,7 +1038,7 @@ public class TDecimalFormat extends TNumberFormat {
|
|||
break;
|
||||
case UNNECESSARY:
|
||||
if (mantissa.remainder(rounding).equals(BigInteger.ZERO)) {
|
||||
throw new TArithmeticException(TString.wrap("Can't avoid rounding"));
|
||||
throw new TArithmeticException("Can't avoid rounding");
|
||||
}
|
||||
break;
|
||||
case HALF_DOWN:
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.function.IntFunction;
|
|||
import java.util.function.IntToDoubleFunction;
|
||||
import java.util.function.IntToLongFunction;
|
||||
import java.util.function.IntUnaryOperator;
|
||||
import org.teavm.classlib.java.lang.TClass;
|
||||
import org.teavm.classlib.java.lang.TComparable;
|
||||
import org.teavm.classlib.java.lang.TDouble;
|
||||
import org.teavm.classlib.java.lang.TFloat;
|
||||
|
@ -30,9 +29,7 @@ import org.teavm.classlib.java.lang.TIllegalArgumentException;
|
|||
import org.teavm.classlib.java.lang.TInteger;
|
||||
import org.teavm.classlib.java.lang.TMath;
|
||||
import org.teavm.classlib.java.lang.TObject;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import org.teavm.classlib.java.lang.TStringBuilder;
|
||||
import org.teavm.classlib.java.lang.reflect.TArray;
|
||||
import org.teavm.classlib.java.util.stream.TDoubleStream;
|
||||
import org.teavm.classlib.java.util.stream.TIntStream;
|
||||
import org.teavm.classlib.java.util.stream.TLongStream;
|
||||
|
@ -126,12 +123,12 @@ public class TArrays extends TObject {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T, U> T[] copyOf(U[] original, int newLength, TClass<? extends T[]> cls) {
|
||||
TClass<?> componentType = cls.getComponentType();
|
||||
T[] result = (T[]) (Object) TArray.newInstance(componentType, newLength);
|
||||
public static <T, U> T[] copyOf(U[] original, int newLength, Class<? extends T[]> cls) {
|
||||
Class<?> componentType = cls.getComponentType();
|
||||
T[] result = (T[]) Array.newInstance(componentType, newLength);
|
||||
int sz = TMath.min(newLength, original.length);
|
||||
for (int i = 0; i < sz; ++i) {
|
||||
result[i] = (T) componentType.cast(TObject.wrap(original[i]));
|
||||
result[i] = (T) componentType.cast(original[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -210,130 +207,130 @@ public class TArrays extends TObject {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T, U> T[] copyOfRange(U[] original, int from, int to, TClass<? extends T[]> newType) {
|
||||
TClass<?> componentType = newType.getComponentType();
|
||||
T[] result = (T[]) (Object) TArray.newInstance(componentType, to - from);
|
||||
public static <T, U> T[] copyOfRange(U[] original, int from, int to, Class<? extends T[]> newType) {
|
||||
Class<?> componentType = newType.getComponentType();
|
||||
T[] result = (T[]) (Object) Array.newInstance(componentType, to - from);
|
||||
for (int i = from; i < to; ++i) {
|
||||
result[i - from] = (T) newType.getComponentType().cast(TObject.wrap(original[i]));
|
||||
result[i - from] = (T) newType.getComponentType().cast(original[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static TString toString(TObject[] a) {
|
||||
public static String toString(TObject[] a) {
|
||||
TStringBuilder sb = new TStringBuilder();
|
||||
sb.append(TString.wrap("["));
|
||||
sb.append("[");
|
||||
for (int i = 0; i < a.length; ++i) {
|
||||
if (i > 0) {
|
||||
sb.append(TString.wrap(", "));
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(a[i]);
|
||||
}
|
||||
sb.append(TString.wrap("]"));
|
||||
return TString.wrap(sb.toString());
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static TString toString(boolean[] a) {
|
||||
public static String toString(boolean[] a) {
|
||||
TStringBuilder sb = new TStringBuilder();
|
||||
sb.append(TString.wrap("["));
|
||||
sb.append("[");
|
||||
for (int i = 0; i < a.length; ++i) {
|
||||
if (i > 0) {
|
||||
sb.append(TString.wrap(", "));
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(a[i]);
|
||||
}
|
||||
sb.append(TString.wrap("]"));
|
||||
return TString.wrap(sb.toString());
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static TString toString(byte[] a) {
|
||||
public static String toString(byte[] a) {
|
||||
TStringBuilder sb = new TStringBuilder();
|
||||
sb.append(TString.wrap("["));
|
||||
sb.append("[");
|
||||
for (int i = 0; i < a.length; ++i) {
|
||||
if (i > 0) {
|
||||
sb.append(TString.wrap(", "));
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(a[i]);
|
||||
}
|
||||
sb.append(TString.wrap("]"));
|
||||
return TString.wrap(sb.toString());
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static TString toString(short[] a) {
|
||||
public static String toString(short[] a) {
|
||||
TStringBuilder sb = new TStringBuilder();
|
||||
sb.append(TString.wrap("["));
|
||||
sb.append("[");
|
||||
for (int i = 0; i < a.length; ++i) {
|
||||
if (i > 0) {
|
||||
sb.append(TString.wrap(", "));
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(a[i]);
|
||||
}
|
||||
sb.append(TString.wrap("]"));
|
||||
return TString.wrap(sb.toString());
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static TString toString(char[] a) {
|
||||
public static String toString(char[] a) {
|
||||
TStringBuilder sb = new TStringBuilder();
|
||||
sb.append(TString.wrap("["));
|
||||
sb.append("[");
|
||||
for (int i = 0; i < a.length; ++i) {
|
||||
if (i > 0) {
|
||||
sb.append(TString.wrap(", "));
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(a[i]);
|
||||
}
|
||||
sb.append(TString.wrap("]"));
|
||||
return TString.wrap(sb.toString());
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static TString toString(int[] a) {
|
||||
public static String toString(int[] a) {
|
||||
TStringBuilder sb = new TStringBuilder();
|
||||
sb.append(TString.wrap("["));
|
||||
sb.append("[");
|
||||
for (int i = 0; i < a.length; ++i) {
|
||||
if (i > 0) {
|
||||
sb.append(TString.wrap(", "));
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(a[i]);
|
||||
}
|
||||
sb.append(TString.wrap("]"));
|
||||
return TString.wrap(sb.toString());
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static TString toString(long[] a) {
|
||||
public static String toString(long[] a) {
|
||||
TStringBuilder sb = new TStringBuilder();
|
||||
sb.append(TString.wrap("["));
|
||||
sb.append("[");
|
||||
for (int i = 0; i < a.length; ++i) {
|
||||
if (i > 0) {
|
||||
sb.append(TString.wrap(", "));
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(a[i]);
|
||||
}
|
||||
sb.append(TString.wrap("]"));
|
||||
return TString.wrap(sb.toString());
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static TString toString(float[] a) {
|
||||
public static String toString(float[] a) {
|
||||
TStringBuilder sb = new TStringBuilder();
|
||||
sb.append(TString.wrap("["));
|
||||
sb.append("[");
|
||||
for (int i = 0; i < a.length; ++i) {
|
||||
if (i > 0) {
|
||||
sb.append(TString.wrap(", "));
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(a[i]);
|
||||
}
|
||||
sb.append(TString.wrap("]"));
|
||||
return TString.wrap(sb.toString());
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static TString toString(double[] a) {
|
||||
public static String toString(double[] a) {
|
||||
TStringBuilder sb = new TStringBuilder();
|
||||
sb.append(TString.wrap("["));
|
||||
sb.append("[");
|
||||
for (int i = 0; i < a.length; ++i) {
|
||||
if (i > 0) {
|
||||
sb.append(TString.wrap(", "));
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(a[i]);
|
||||
}
|
||||
sb.append(TString.wrap("]"));
|
||||
return TString.wrap(sb.toString());
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void fill(long[] a, int fromIndex, int toIndex, long val) {
|
||||
|
@ -1529,22 +1526,22 @@ public class TArrays extends TObject {
|
|||
}
|
||||
}
|
||||
|
||||
public static TString deepToString(Object[] a) {
|
||||
TStringBuilder sb = new TStringBuilder();
|
||||
public static String deepToString(Object[] a) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
deepToString(a, sb, new TArrayList<>());
|
||||
return TString.wrap(sb.toString());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static void deepToString(Object[] a, TStringBuilder out, TList<Object[]> visited) {
|
||||
private static void deepToString(Object[] a, StringBuilder out, TList<Object[]> visited) {
|
||||
out.append('[');
|
||||
if (visited.contains(a)) {
|
||||
out.append(TString.wrap("..."));
|
||||
out.append("...");
|
||||
} else {
|
||||
visited.add(a);
|
||||
if (a.length > 0) {
|
||||
deepToString(a[0], out, visited);
|
||||
for (int i = 1; i < a.length; ++i) {
|
||||
out.append(TString.wrap(", "));
|
||||
out.append(", ");
|
||||
deepToString(a[i], out, visited);
|
||||
}
|
||||
}
|
||||
|
@ -1553,11 +1550,11 @@ public class TArrays extends TObject {
|
|||
out.append(']');
|
||||
}
|
||||
|
||||
private static void deepToString(Object a, TStringBuilder out, TList<Object[]> visited) {
|
||||
private static void deepToString(Object a, StringBuilder out, TList<Object[]> visited) {
|
||||
if (a instanceof Object[]) {
|
||||
deepToString((Object[]) a, out, visited);
|
||||
} else {
|
||||
out.append(TObject.wrap(a));
|
||||
out.append(a);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,14 +15,11 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.util;
|
||||
|
||||
import org.teavm.classlib.java.lang.TClass;
|
||||
import org.teavm.classlib.java.lang.TObject;
|
||||
|
||||
class TCheckedCollection<E> implements TCollection<E> {
|
||||
TCollection<E> innerCollection;
|
||||
TClass<E> type;
|
||||
Class<E> type;
|
||||
|
||||
public TCheckedCollection(TCollection<E> innerCollection, TClass<E> type) {
|
||||
public TCheckedCollection(TCollection<E> innerCollection, Class<E> type) {
|
||||
this.innerCollection = innerCollection;
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -59,7 +56,7 @@ class TCheckedCollection<E> implements TCollection<E> {
|
|||
|
||||
@Override
|
||||
public boolean add(E e) {
|
||||
return innerCollection.add(type.cast(TObject.wrap(e)));
|
||||
return innerCollection.add(type.cast(e));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,7 +74,7 @@ class TCheckedCollection<E> implements TCollection<E> {
|
|||
public boolean addAll(TCollection<? extends E> c) {
|
||||
Object[] items = c.toArray();
|
||||
for (int i = 0; i < items.length; ++i) {
|
||||
items[i] = type.cast(TObject.wrap(items[i]));
|
||||
items[i] = type.cast(items[i]);
|
||||
}
|
||||
return innerCollection.addAll(TArrays.asList((E[]) items));
|
||||
}
|
||||
|
|
|
@ -15,13 +15,10 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.util;
|
||||
|
||||
import org.teavm.classlib.java.lang.TClass;
|
||||
import org.teavm.classlib.java.lang.TObject;
|
||||
|
||||
class TCheckedList<E> extends TCheckedCollection<E> implements TList<E> {
|
||||
private TList<E> innerList;
|
||||
|
||||
public TCheckedList(TList<E> innerList, TClass<E> type) {
|
||||
public TCheckedList(TList<E> innerList, Class<E> type) {
|
||||
super(innerList, type);
|
||||
this.innerList = innerList;
|
||||
}
|
||||
|
@ -31,7 +28,7 @@ class TCheckedList<E> extends TCheckedCollection<E> implements TList<E> {
|
|||
public boolean addAll(int index, TCollection<? extends E> c) {
|
||||
Object[] items = c.toArray();
|
||||
for (int i = 0; i < items.length; ++i) {
|
||||
items[i] = type.cast(TObject.wrap(items[i]));
|
||||
items[i] = type.cast(items[i]);
|
||||
}
|
||||
return innerList.addAll(index, TArrays.asList((E[]) items));
|
||||
}
|
||||
|
@ -43,12 +40,12 @@ class TCheckedList<E> extends TCheckedCollection<E> implements TList<E> {
|
|||
|
||||
@Override
|
||||
public E set(int index, E element) {
|
||||
return innerList.set(index, type.cast(TObject.wrap(element)));
|
||||
return innerList.set(index, type.cast(element));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(int index, E element) {
|
||||
innerList.add(index, type.cast(TObject.wrap(element)));
|
||||
innerList.add(index, type.cast(element));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,14 +15,11 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.util;
|
||||
|
||||
import org.teavm.classlib.java.lang.TClass;
|
||||
import org.teavm.classlib.java.lang.TObject;
|
||||
|
||||
class TCheckedListIterator<E> implements TListIterator<E> {
|
||||
private TListIterator<E> innerIterator;
|
||||
private TClass<E> type;
|
||||
private Class<E> type;
|
||||
|
||||
public TCheckedListIterator(TListIterator<E> innerIterator, TClass<E> type) {
|
||||
TCheckedListIterator(TListIterator<E> innerIterator, Class<E> type) {
|
||||
this.innerIterator = innerIterator;
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -64,11 +61,11 @@ class TCheckedListIterator<E> implements TListIterator<E> {
|
|||
|
||||
@Override
|
||||
public void set(E e) {
|
||||
innerIterator.set(type.cast(TObject.wrap(e)));
|
||||
innerIterator.set(type.cast(e));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(E e) {
|
||||
innerIterator.add(type.cast(TObject.wrap(e)));
|
||||
innerIterator.add(type.cast(e));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,15 +15,12 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.util;
|
||||
|
||||
import org.teavm.classlib.java.lang.TClass;
|
||||
import org.teavm.classlib.java.lang.TObject;
|
||||
|
||||
class TCheckedMap<K, V> implements TMap<K, V> {
|
||||
private TMap<K, V> innerMap;
|
||||
private TClass<K> keyType;
|
||||
private TClass<V> valueType;
|
||||
private Class<K> keyType;
|
||||
private Class<V> valueType;
|
||||
|
||||
public TCheckedMap(TMap<K, V> innerMap, TClass<K> keyType, TClass<V> valueType) {
|
||||
public TCheckedMap(TMap<K, V> innerMap, Class<K> keyType, Class<V> valueType) {
|
||||
this.innerMap = innerMap;
|
||||
this.keyType = keyType;
|
||||
this.valueType = valueType;
|
||||
|
@ -56,7 +53,7 @@ class TCheckedMap<K, V> implements TMap<K, V> {
|
|||
|
||||
@Override
|
||||
public V put(K key, V value) {
|
||||
return innerMap.put(keyType.cast(TObject.wrap(key)), valueType.cast(TObject.wrap(value)));
|
||||
return innerMap.put(keyType.cast(key), valueType.cast(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,8 +66,8 @@ class TCheckedMap<K, V> implements TMap<K, V> {
|
|||
m = new THashMap<>(m);
|
||||
for (TIterator<? extends Entry<? extends K, ? extends V>> iter = m.entrySet().iterator(); iter.hasNext();) {
|
||||
Entry<? extends K, ? extends V> entry = iter.next();
|
||||
keyType.cast(TObject.wrap(entry.getKey()));
|
||||
valueType.cast(TObject.wrap(entry.getValue()));
|
||||
keyType.cast(entry.getKey());
|
||||
valueType.cast(entry.getValue());
|
||||
}
|
||||
innerMap.putAll(m);
|
||||
}
|
||||
|
|
|
@ -15,10 +15,8 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.util;
|
||||
|
||||
import org.teavm.classlib.java.lang.TClass;
|
||||
|
||||
class TCheckedSet<E> extends TCheckedCollection<E> implements TSet<E> {
|
||||
public TCheckedSet(TCollection<E> innerCollection, TClass<E> type) {
|
||||
public TCheckedSet(TCollection<E> innerCollection, Class<E> type) {
|
||||
super(innerCollection, type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -572,19 +572,19 @@ public class TCollections extends TObject {
|
|||
return list;
|
||||
}
|
||||
|
||||
public static <E> TCollection<E> checkedCollection(TCollection<E> c, TClass<E> type) {
|
||||
public static <E> TCollection<E> checkedCollection(TCollection<E> c, Class<E> type) {
|
||||
return new TCheckedCollection<>(c, type);
|
||||
}
|
||||
|
||||
public static <E> TSet<E> checkedSet(TSet<E> s, TClass<E> type) {
|
||||
public static <E> TSet<E> checkedSet(TSet<E> s, Class<E> type) {
|
||||
return new TCheckedSet<>(s, type);
|
||||
}
|
||||
|
||||
public static <E> TList<E> checkedList(TList<E> list, TClass<E> type) {
|
||||
public static <E> TList<E> checkedList(TList<E> list, Class<E> type) {
|
||||
return new TCheckedList<>(list, type);
|
||||
}
|
||||
|
||||
public static <K, V> TMap<K, V> checkedMap(TMap<K, V> m, TClass<K> keyType, TClass<V> valueType) {
|
||||
public static <K, V> TMap<K, V> checkedMap(TMap<K, V> m, Class<K> keyType, Class<V> valueType) {
|
||||
return new TCheckedMap<>(m, keyType, valueType);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
package org.teavm.classlib.java.util;
|
||||
|
||||
import org.teavm.classlib.java.lang.TRuntimeException;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
import org.teavm.classlib.java.lang.TThrowable;
|
||||
|
||||
public class TConcurrentModificationException extends TRuntimeException {
|
||||
|
@ -26,11 +25,11 @@ public class TConcurrentModificationException extends TRuntimeException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TConcurrentModificationException(TString message, TThrowable cause) {
|
||||
public TConcurrentModificationException(String message, TThrowable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TConcurrentModificationException(TString message) {
|
||||
public TConcurrentModificationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
package org.teavm.classlib.java.util;
|
||||
|
||||
import org.teavm.classlib.java.lang.TRuntimeException;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
|
||||
public class TMissingResourceException extends TRuntimeException {
|
||||
private static final long serialVersionUID = 6730397307327337970L;
|
||||
|
@ -24,7 +23,7 @@ public class TMissingResourceException extends TRuntimeException {
|
|||
private String key;
|
||||
|
||||
public TMissingResourceException(String s, String className, String key) {
|
||||
super(TString.wrap(s));
|
||||
super(s);
|
||||
this.className = className;
|
||||
this.key = key;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
package org.teavm.classlib.java.util;
|
||||
|
||||
import org.teavm.classlib.java.lang.TRuntimeException;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
|
||||
public class TNoSuchElementException extends TRuntimeException {
|
||||
private static final long serialVersionUID = -4890604137042866919L;
|
||||
|
@ -25,7 +24,7 @@ public class TNoSuchElementException extends TRuntimeException {
|
|||
super();
|
||||
}
|
||||
|
||||
public TNoSuchElementException(TString message) {
|
||||
public TNoSuchElementException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,14 +15,13 @@
|
|||
*/
|
||||
package org.teavm.classlib.java.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import org.teavm.classlib.java.io.TBufferedInputStream;
|
||||
import org.teavm.classlib.java.io.TIOException;
|
||||
import org.teavm.classlib.java.io.TInputStream;
|
||||
import org.teavm.classlib.java.io.TOutputStream;
|
||||
import org.teavm.classlib.java.io.TOutputStreamWriter;
|
||||
import org.teavm.classlib.java.io.TPrintStream;
|
||||
import org.teavm.classlib.java.io.TWriter;
|
||||
import org.teavm.classlib.java.lang.TString;
|
||||
|
||||
public class TProperties extends THashtable<Object, Object> {
|
||||
/**
|
||||
|
@ -139,17 +138,17 @@ public class TProperties extends THashtable<Object, Object> {
|
|||
}
|
||||
if (property.length() > 40) {
|
||||
buffer.append(property.substring(0, 37));
|
||||
buffer.append("..."); //$NON-NLS-1$
|
||||
buffer.append("...");
|
||||
} else {
|
||||
buffer.append(property);
|
||||
}
|
||||
out.println(TString.wrap(buffer.toString()));
|
||||
out.println(buffer.toString());
|
||||
buffer.setLength(0);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("fallthrough")
|
||||
public synchronized void load(TInputStream in) throws TIOException {
|
||||
public synchronized void load(TInputStream in) throws IOException {
|
||||
if (in == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
@ -339,10 +338,10 @@ public class TProperties extends THashtable<Object, Object> {
|
|||
}
|
||||
|
||||
@Deprecated
|
||||
public void save(TOutputStream out, String comment) {
|
||||
public void save(OutputStream out, String comment) {
|
||||
try {
|
||||
store(out, comment);
|
||||
} catch (TIOException e) {
|
||||
} catch (IOException e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
@ -351,8 +350,8 @@ public class TProperties extends THashtable<Object, Object> {
|
|||
return put(name, value);
|
||||
}
|
||||
|
||||
public synchronized void store(TOutputStream out, String comments) throws TIOException {
|
||||
TOutputStreamWriter writer = new TOutputStreamWriter(out, "ISO8859_1");
|
||||
public synchronized void store(OutputStream out, String comments) throws IOException {
|
||||
OutputStreamWriter writer = new OutputStreamWriter(out, "ISO8859_1");
|
||||
if (comments != null) {
|
||||
writeComments(writer, comments);
|
||||
}
|
||||
|
@ -374,7 +373,7 @@ public class TProperties extends THashtable<Object, Object> {
|
|||
writer.flush();
|
||||
}
|
||||
|
||||
private void writeComments(TWriter writer, String comments) throws TIOException {
|
||||
private void writeComments(Writer writer, String comments) throws IOException {
|
||||
writer.write('#');
|
||||
char[] chars = comments.toCharArray();
|
||||
for (int index = 0; index < chars.length; index++) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user