Used to URL-bind {@link AnnotatedLargeText}.
339235
public AnnotatedLargeText<Computer> getLogText() {
        checkPermission(CONNECT);
        return new AnnotatedLargeText<>(getLogFile(), Charset.defaultCharset(), false, this);
    }
671122
public static synchronized Document getEventDocFromUrl(String url) throws TvDbException {
        Document doc = null;

        String webPage = getValidWebpage(url);
        
        // If the webpage returned is null or empty, quit
        if(StringUtils.isBlank(webPage)){
            return null;
        }
        
        try (InputStream in = new ByteArrayInputStream(webPage.getBytes(CHARSET))) {
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            DocumentBuilder db = dbf.newDocumentBuilder();
            doc = db.parse(in);
            doc.getDocumentElement().normalize();
        } catch (UnsupportedEncodingException ex) {
            throw new TvDbException(ApiExceptionType.INVALID_URL, "Unable to encode URL", url, ex);
        } catch (ParserConfigurationException | SAXException | IOException error) {
            throw new TvDbException(ApiExceptionType.MAPPING_FAILED, ERROR_UNABLE_TO_PARSE, url, error);
        }

        return doc;
    }
833159
public void setFullTextLinks(int i, FullTextLink v) { 
    if (FullTextLinkList_Type.featOkTst && ((FullTextLinkList_Type)jcasType).casFeat_fullTextLinks == null)
      jcasType.jcas.throwFeatMissing("fullTextLinks", "de.julielab.jules.types.FullTextLinkList");
    jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((FullTextLinkList_Type)jcasType).casFeatCode_fullTextLinks), i);
    jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((FullTextLinkList_Type)jcasType).casFeatCode_fullTextLinks), i, jcasType.ll_cas.ll_getFSRef(v));}
749311
public static String urlEncode(final String text) {
        try {
            return URLEncoder.encode(text, StandardCharsets.UTF_8.name());
        } catch (final UnsupportedEncodingException e) {
            final String message = "Unable to encode text : " + text;
            throw new TechnicalException(message, e);
        }
    }
265294
protected Binding bindAnnotatedWith(TypeReference bind, TypeReference annotatedWith, TypeReference to,
			String functionName) {
		final StringConcatenationClient client = new StringConcatenationClient() {
			@Override
			protected void appendTo(TargetStringConcatenation builder) {
				builder.append("binder.bind("); //$NON-NLS-1$
				builder.append(bind);
				builder.append(".class).annotatedWith("); //$NON-NLS-1$
				builder.append(annotatedWith);
				builder.append(".class).to("); //$NON-NLS-1$
				builder.append(to);
				builder.append(".class);"); //$NON-NLS-1$
			}
		};
		String fctname = functionName;
		if (Strings.isEmpty(fctname)) {
			fctname = bind.getSimpleName();
		}
		final BindKey key = new GuiceModuleAccess.BindKey(formatFunctionName(fctname), null, false, false);
		final  BindValue statements = new BindValue(null, null, false, Collections.singletonList(client));
	    return new Binding(key, statements, true, this.name);
	}
1372131
private void handleRawText(TextCursor cursor, int limit, ArrayList<MDText> elements) {
        while (true) {
            BasicUrl url = findUrl(cursor, limit);
            if (url != null) {
                String link = cursor.text.substring(url.getStart(), url.getEnd());

                // Handling text before url first
                addText(cursor, url.getStart(), elements);

                // Adding url
                elements.add(new MDUrl(link, link));

                // Adjusting offset
                cursor.currentOffset = url.getEnd();

                continue;
            }

            addText(cursor, limit, elements);

            return;
        }
    }
33016
public static IAnnotationBinding getAnnotationBinding(
            IAnnotationBinding[] annotations, String annotationClassName) {
        if (annotations == null) {
            return null;
        }
        if (annotationClassName == null) {
            throw new NullPointerException();
        }

        for (IAnnotationBinding annotation : annotations) {
            String qName = annotation.getAnnotationType().getBinaryName();
            assert qName != null;
            // TODO if multiple annotations for annotationClassName exists
            if (qName.equals(annotationClassName)) {
                return annotation;
            }
        }
        return null;
    }
629050
@javax.annotation.Nonnull
  public static com.simiacryptus.util.io.MarkdownNotebookOutput get(@javax.annotation.Nonnull Class<?> sourceClass, @Nullable String absoluteUrl, @javax.annotation.Nonnull String... suffix) {
    try {
      final StackTraceElement callingFrame = Thread.currentThread().getStackTrace()[2];
      final String methodName = callingFrame.getMethodName();
      final String className = sourceClass.getCanonicalName();
      @javax.annotation.Nonnull File path = new File(Util.mkString(File.separator, "reports", className.replaceAll("\\.", "/").replaceAll("\\$", "/")));
      for (int i = 0; i < suffix.length - 1; i++) path = new File(path, suffix[i]);
      String testName = suffix.length == 0 ? methodName : suffix[suffix.length - 1];
      path = new File(path, testName + ".md");
      path.getParentFile().mkdirs();
      @javax.annotation.Nonnull com.simiacryptus.util.io.MarkdownNotebookOutput notebookOutput = new com.simiacryptus.util.io.MarkdownNotebookOutput(path, testName);
      if (null != absoluteUrl) {
        try {
          String url = new URI(absoluteUrl + "/" + path.toPath().toString().replaceAll("\\\\", "/")).normalize().toString();
          notebookOutput.setAbsoluteUrl(url);
        } catch (URISyntaxException e) {
          throw new RuntimeException(e);
        }
      }
      return notebookOutput;
    } catch (@javax.annotation.Nonnull final FileNotFoundException e) {
      throw new RuntimeException(e);
    }
  }
247393
@javax.annotation.Nonnull
  public com.simiacryptus.util.io.MarkdownNotebookOutput setAbsoluteUrl(final String absoluteUrl) {
    this.absoluteUrl = absoluteUrl;
    return this;
  }
817838
@SuppressWarnings("rawtypes")
	private MailInboundChannelAdapterSpec getImapFlowBuilder(URLName urlName) {
		return Mail.imapInboundAdapter(urlName.toString())
				.shouldMarkMessagesAsRead(this.properties.isMarkAsRead());
	}
743939
@Override
    public void setAsText(final String text) {
        if (BeanUtils.isNull(text)) {
            setValue(null);
            return;
        }
        Object newValue = Boolean.valueOf(text);
        setValue(newValue);
    }
920110
public FullTextLink getFullTextLinks(int i) {
    if (FullTextLinkList_Type.featOkTst && ((FullTextLinkList_Type)jcasType).casFeat_fullTextLinks == null)
      jcasType.jcas.throwFeatMissing("fullTextLinks", "de.julielab.jules.types.FullTextLinkList");
    jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((FullTextLinkList_Type)jcasType).casFeatCode_fullTextLinks), i);
    return (FullTextLink)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((FullTextLinkList_Type)jcasType).casFeatCode_fullTextLinks), i)));}
923371
public void bind(String url, Functions.Func callback) {
        cropper.croppie("bind", url).then((result, object) -> {
            callback.call();
            return true;
        });
    }
1079509
public static void addOrigHeader(HttpServletResponse response, String url) {
		response.setHeader(LINK, makeLink(url, ORIGINAL));
	}
758087
function getExpandedUrl(url, options) {
	var x = 0,
		i;
	if (options.urls) {
		i = options.urls.length;
		while (x < i) {
			if (options.urls[x].match === url) {
				if (options.urls[x].expanded) {
					return options.urls[x].expanded;
				}
				return null;
			}
			x++;
		}
	}
	return null;
}
72430
private InputStream downloadUrl(String myurl) throws IOException {
        InputStream is = null;
        // Only display the first 500 characters of the retrieved
        // web page content.
        try {
            URL url = new URL(myurl);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setReadTimeout(28000 /* milliseconds */);
            //set back to 15000, 10000
            conn.setConnectTimeout(30000 /* milliseconds */);
            conn.setRequestMethod("GET");
            conn.setDoInput(true);
            // Starts the query
            conn.connect();
            is = conn.getInputStream();
            return is;
        } finally {
            if (is != null) {
                is.close();
            }
        }
    }
305363
void parseDocument(final Reader reader, final int suggestedBufferSize, final IRawHandler handler)
            throws RawParseException {

        // We are trying to read the entire resource into the buffer. If it's not big enough,
        // then it will have to be grown. Note grown buffers are not maintained by the pool,
        // so template cache should play a more important role for this, allowing the system to
        // not require the creation of large buffers each time.

        final long parsingStartTimeNanos = System.nanoTime();

        char[] buffer = null;

        try {

            handler.handleDocumentStart(parsingStartTimeNanos, 1, 1);

            int bufferSize = suggestedBufferSize;
            buffer = this.pool.allocateBuffer(bufferSize);

            int bufferContentSize = reader.read(buffer);

            boolean cont = (bufferContentSize != -1);

            while (cont) {

                if (bufferContentSize == bufferSize) {
                    // Buffer is not big enough, double it!

                    char[] newBuffer = null;
                    try {

                        bufferSize *= 2;

                        newBuffer = this.pool.allocateBuffer(bufferSize);
                        System.arraycopy(buffer, 0, newBuffer, 0, bufferContentSize);

                        this.pool.releaseBuffer(buffer);

                        buffer = newBuffer;

                    } catch (final Exception ignored) {
                        this.pool.releaseBuffer(newBuffer);
                    }

                }

                final int read = reader.read(buffer, bufferContentSize, (bufferSize - bufferContentSize));
                if (read != -1) {
                    bufferContentSize += read;
                } else {
                    cont = false;
                }

            }

            handler.handleText(buffer, 0, bufferContentSize, 1, 1);

            final int[] lastLineCol = computeLastLineCol(buffer, bufferContentSize);

            final long parsingEndTimeNanos = System.nanoTime();
            handler.handleDocumentEnd(parsingEndTimeNanos, (parsingEndTimeNanos - parsingStartTimeNanos), lastLineCol[0], lastLineCol[1]);

        } catch (final RawParseException e) {
            throw e;
        } catch (final Exception e) {
            throw new RawParseException(e);
        } finally {
            this.pool.releaseBuffer(buffer);
            try {
                reader.close();
            } catch (final Throwable ignored) {
                // This exception can be safely ignored
            }
        }

    }