private void SetTarget(CloneableAntlrFileStream stream) { if (PRELOAD_SOURCES) { strongInputStream = stream; } else { inputStream = new WeakReference <CloneableAntlrFileStream>(stream); } }
public ICharStream GetInputStream() { CloneableAntlrFileStream stream; if (!TryGetTarget(out stream)) { stream = new CloneableAntlrFileStream(source, ENCODING); SetTarget(stream); } return(new JavaUnicodeInputStream(stream.CreateCopy())); }
private bool TryGetTarget(out CloneableAntlrFileStream stream) { if (PRELOAD_SOURCES) { stream = strongInputStream; return(strongInputStream != null); } else { if (inputStream == null) { stream = null; return(false); } return(inputStream.TryGetTarget(out stream)); } }