public static String readStringFromStream(InputStream inputStream) throws IOException { int length = readIntFromStream(inputStream); byte[] bytes = new byte[length]; readFully(bytes, inputStream); return new String(bytes, Charset.forName("UTF-8")); }
public static int readIntFromStream(InputStream inputStream) throws IOException { byte[] arr = new byte[4]; readFully(arr, inputStream); return readInt(arr, 0); }
public void initialize(InputStream inputStream) { try { setPosition(0); int size = Bytes.readIntFromStream(inputStream); resizeIfNecessary(size); Bytes.readFully(buffer, inputStream, size); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void load(InputStream inputStream) { position = 0; currentIndex = 0; try { int size = Bytes.readIntFromStream(inputStream); resizeIfNecessary(size); Bytes.readFully(buffer, inputStream, size); loadNextMiniBlock(); } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void load(InputStream inputStream) { position = 0; currentIndex = 0; try { int size = Bytes.readIntFromStream(inputStream); resizeIfNecessary(size); Bytes.readFully(buffer, inputStream, size); loadNextMiniBlock(); } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void load(InputStream inputStream) { position = 0; currentIndex = 0; try { int size = Bytes.readIntFromStream(inputStream); resizeIfNecessary(size); Bytes.readFully(buffer, inputStream, size); loadNextMiniBlock(); } catch (IOException e) { throw new RuntimeException(e); } }
@Override public void load(InputStream inputStream) { try { currentIndex = 0; isFirstValue = true; position = 0; totalValueCount = readIntFromStream(inputStream); firstValue = readIntFromStream(inputStream); if (totalValueCount <= 1) { return; } int size = readIntFromStream(inputStream); resizeIfNecessary(size); Bytes.readFully(buffer, inputStream, size); loadNextMiniBlock(); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void load(InputStream inputStream) { try { currentIndex = 0; isFirstValue = true; position = 0; totalValueCount = readIntFromStream(inputStream); firstValue = readIntFromStream(inputStream); if (totalValueCount <= 1) { return; } int size = readIntFromStream(inputStream); resizeIfNecessary(size); Bytes.readFully(buffer, inputStream, size); loadNextMiniBlock(); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void load(InputStream inputStream) { try { currentIndex = 0; isFirstValue = true; position = 0; totalValueCount = readIntFromStream(inputStream); firstValue = readIntFromStream(inputStream); if (totalValueCount <= 1) { return; } int size = readIntFromStream(inputStream); resizeIfNecessary(size); Bytes.readFully(buffer, inputStream, size); loadNextMiniBlock(); } catch (Exception e) { throw new RuntimeException(e); } }