Gets the integer value that is stored in UTF-8 like fashion, in Big Endian but with the high bit on each number indicating if it continues or not
(InputStream stream)
| 306 | * but with the high bit on each number indicating if it continues or not |
| 307 | */ |
| 308 | public static long readUE7(InputStream stream) throws IOException { |
| 309 | int i; |
| 310 | long v = 0; |
| 311 | while ((i = stream.read()) >= 0) { |
| 312 | v = v << 7; |
| 313 | if ((i & 128) == 128) { |
| 314 | // Continues |
| 315 | v += (i&127); |
| 316 | } else { |
| 317 | // Last value |
| 318 | v += i; |
| 319 | break; |
| 320 | } |
| 321 | } |
| 322 | return v; |
| 323 | } |
| 324 | // public static void writeUE7(OutputStream out, long value) throws IOException { |
| 325 | // // TODO Implement |
| 326 | // } |