Read at most 2048 single byte characters
()
| 170 | * Read at most 2048 single byte characters |
| 171 | */ |
| 172 | public String readString() { |
| 173 | // 2k read buffer. |
| 174 | byte[] readbuf = new byte[2048]; |
| 175 | byte c; |
| 176 | int l = 0; |
| 177 | do { |
| 178 | c = (byte) readByte(); |
| 179 | if (c == -1 || c == 0) |
| 180 | break; |
| 181 | |
| 182 | readbuf[l] = c; |
| 183 | l++; |
| 184 | } while (l < 2047); |
| 185 | |
| 186 | return new String(readbuf, 0, l); |
| 187 | } |
| 188 | |
| 189 | public void writeCoord(float f) { |
| 190 | writeShort((int) (f * 8)); |