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")); }
@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); } }
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 { int num = Bytes.readIntFromStream(inputStream); if (num > 0) { index = 0; nextTrueBit = -1; bitmap.deserialize(new DataInputStream(inputStream)); intIterator = bitmap.intIterator(); if (intIterator.hasNext()) { nextTrueBit = intIterator.next(); } } } catch (Exception e) { throw new RuntimeException(e); } } }
private void loadNextPage() { try { currentPageHeader = new PageHeader(); currentPageHeader.setLastPage(Bytes.readBoolFromStream(inputStream)); currentPageHeader.setPageSize(Bytes.readIntFromStream(inputStream)); int mapSize = Bytes.readIntFromStream(inputStream); for (int i = 0; i < mapSize; i++) { Class<?> clazz = Class.forName(Bytes.readStringFromStream(inputStream)); int value = Bytes.readIntFromStream(inputStream); currentPageHeader.getValueToClassMap().put(value, clazz); } if (conf.isReferenceTrackingEnabled()) { context = new References.ReferenceTrackingReadContext(conf); } else { context = new Contexts.ReadContextImpl( conf ); } serializerContext.finish((Contexts.ReadContextImpl) context); recordCount = currentPageHeader.getPageSize(); context.setPageHeader(currentPageHeader); context.loadFromInputStream(inputStream); } catch (Exception e) { throw new SidneyException(e); } }