Fill cache from an input stream.

@param size Expected size
@param in Input stream
@throws IOException
496995
protected void loadCache(int size, InputStream in) throws IOException {
    // Expect a sparse matrix here
    cache = new Long2FloatOpenHashMap(size * 20);
    cache.defaultReturnValue(Float.POSITIVE_INFINITY);
    min = Integer.MAX_VALUE;
    max = Integer.MIN_VALUE;
    parser.parse(in, new DistanceCacheWriter() {
      @Override
      public void put(int id1, int id2, double distance) {
        if(id1 < id2) {
          min = id1 < min ? id1 : min;
          max = id2 > max ? id2 : max;
        }
        else {
          min = id2 < min ? id2 : min;
          max = id1 > max ? id1 : max;
        }
        cache.put(makeKey(id1, id2), (float) distance);
      }
    });
    if(min != 0) {
      LOG.verbose("Distance matrix is supposed to be 0-indexed. Choosing offset " + min + " to compensate.");
    }
    if(max + 1 - min != size) {
      LOG.warning("ID range is not consistent with relation size.");
    }
  }
643425
public static <K,V> Cache<K,V> newSoftMemoryCache(int size) {
        return new MemoryCache<>(true, size);
    }
463580
public void init(boolean useDirect, int outSize, int inSize, int cacheSize) {
        super.init(useDirect, outSize, inSize, cacheSize);
    }
518935
public static long copy(InputStream in, OutputStream out) throws IORuntimeException {
		return copy(in, out, DEFAULT_BUFFER_SIZE);
	}
137719
private void setLimit(int from, int size) {
		request.setFrom(from);

		if (size > -1) {
			request.setSize(size);
		}
	}
315077
static final byte[] inflate(final byte[] in, final int offset, final int length)
			throws DataFormatException {
		byte[] infBuf = new byte[length << 1];
		int payloadLength;
		synchronized (inflater) {
			inflater.reset();
			inflater.setInput(in, offset, length);
			payloadLength = inflater.inflate(infBuf);
		}
		return resizeBuffer(infBuf, payloadLength);
	}
1289363
private void createLoca(int size) throws IOException {
        pad4();
        locaOffset = currentPos;
        writeULong(locaDirOffset + 4, currentPos);
        writeULong(locaDirOffset + 8, size * 4 + 4);
        currentPos += size * 4 + 4;
        realSize += size * 4 + 4;
    }
648714
private static void inflater(InputStream in, OutputStream out) {
		final InflaterOutputStream ios = (out instanceof InflaterOutputStream) ? (InflaterOutputStream) out : new InflaterOutputStream(out, new Inflater(true));
		IoUtil.copy(in, ios);
		try {
			ios.finish();
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
	}
829766
public void readAll(InputStream in) throws IOException {
    int read = 0;
    do {
      grow(length);
      read = data.setBytes(length, in, data.length() - length);
      if (read > 0) {
        length += read;
      }
    } while (in.available() > 0);
  }
558308
public static void copy(InputStream in, Writer writer) throws IOException {
    copy(getInputStreamReader(in), writer);
    writer.flush();
  }
1298346
public void setBytes(byte[] data, int size) {
        System.arraycopy(data, 0, this.data, 0, data.length);
        this.size = size;
    }
52385
public static void copyPartialContent(InputStream in, OutputStream out, Range r) throws IOException {
    IOUtils.copyLarge(in, out, r.start, r.length);
  }
29307
public static long copy(InputStream in, OutputStream out, int bufferSize) throws IORuntimeException {
		return copy(in, out, bufferSize, null);
	}
107853
public void create(int iStartSize) throws IOException {
    if (iStartSize == -1)
      iStartSize = DEFAULT_SIZE;

    openChannel(iStartSize);

    setFilledUpTo(0);
    setSize(maxSize > 0 && iStartSize > maxSize ? maxSize : iStartSize);
    setSoftlyClosed(!failCheck);
  }
746384
public void load(InputStream in) throws IOException {

	BufferedReader input = IOUtil.toBufferedReader(new InputStreamReader(in));
	String read;
	Map section = null;
	String sectionName;
	while ((read = input.readLine()) != null) {
	    if (read.startsWith(";") || read.startsWith("#")) {
		continue;
	    }
	    else if (read.startsWith("[")) {
		// new section
		sectionName = read.substring(1, read.indexOf("]")).trim().toLowerCase();
		section = getSectionEL(sectionName);
		if (section == null) {
		    section = newMap();
		    sections.put(sectionName, section);
		}
	    }
	    else if (read.indexOf("=") != -1 && section != null) {
		// new key
		String key = read.substring(0, read.indexOf("=")).trim().toLowerCase();
		String value = read.substring(read.indexOf("=") + 1).trim();
		section.put(key, value);
	    }
	}

    }
1277263
public void init(InputStream in) throws IOException 
    {
        if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
            logger.logp(Level.FINE, CLASS_NAME,"init", "init"); 
        } 
        this.in = in;
        next();
        obs=null;
    }
150918
public void setPreferredCacheSize(long size) {
        int intSize = (int) size;
        activator.setCachePreferredMaxSize(intSize);
        wrapperManager.setWrapperCacheSize(2 * intSize);
    }