mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Fix compilation
This commit is contained in:
+23
-2
@@ -28,6 +28,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectStreamException;
|
||||
import java.io.Serializable;
|
||||
import java.io.UTFDataFormatException;
|
||||
|
||||
public final class CharSequenceReader<S extends CharSequence>
|
||||
implements BytesReader<S>, StatefulCopyable<CharSequenceReader<S>> {
|
||||
@@ -81,12 +82,32 @@ public final class CharSequenceReader<S extends CharSequence>
|
||||
this.identity = identity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method copied here because corresponding method in AbstractBytes was turned
|
||||
* to instance method, but we need to call on Bytes, not AbstractBytes
|
||||
*/
|
||||
private static void readUTF0(Bytes b, @NotNull Appendable appendable, int utflen)
|
||||
throws IOException {
|
||||
int count = 0;
|
||||
|
||||
while (count < utflen) {
|
||||
int c = b.readUnsignedByteOrThrow();
|
||||
if (c >= 128) {
|
||||
b.position(b.position() - 1);
|
||||
AbstractBytes.readUTF2(b, appendable, utflen, count);
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
appendable.append((char) c);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public S read(@NotNull Bytes bytes, long size) {
|
||||
sb.setLength(0);
|
||||
try {
|
||||
AbstractBytes.readUTF0(bytes, sb, (int) size);
|
||||
readUTF0(bytes, sb, (int) size);
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
@@ -109,7 +130,7 @@ public final class CharSequenceReader<S extends CharSequence>
|
||||
appendable = sb;
|
||||
}
|
||||
try {
|
||||
AbstractBytes.readUTF0(bytes, appendable, (int) size);
|
||||
readUTF0(bytes, appendable, (int) size);
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user