/** * Suspends encoding of the stream. * May be helpful if you need to embed a piece of * base64-encoded data in a stream. * * @throws java.io.IOException if there's an error flushing * @since 1.5.1 */ public void suspendEncoding() throws java.io.IOException { flushBase64(); this.suspendEncoding = true; } // end suspendEncoding
@Override public String generateUrl(String cssResultLocation) { return URIUtils.addSuffix(cssResultLocation, Constants.SOURCE_MAP_SUFFIX); } }
private String toCss(Expression direction) { InStringCssPrinter printer = new InStringCssPrinter(); printer.append(direction); return printer.toString(); }
public <T> MatchMarker<T> prefixMatches(List<T> lookFor, List<T> inList, ListMemberComparator<T> comparator) { if (lookFor.isEmpty() || lookFor.size() > inList.size()) return null; List<T> relevantInList = ArraysUtils.sameLengthPrefix(inList, lookFor); List<T> relevantInListWithoutLast = ArraysUtils.sublistWithoutLast(relevantInList); List<T> lookForWithoutLast = ArraysUtils.sublistWithoutLast(lookFor); if (!equals(lookForWithoutLast, relevantInListWithoutLast, comparator)) return null; boolean isPrefix = comparator.prefix(ArraysUtils.last(lookFor), ArraysUtils.last(relevantInList)); if (isPrefix) return new MatchMarker<T>(ArraysUtils.first(relevantInList), ArraysUtils.last(relevantInList), false); return null; }
public <T> MatchMarker<T> suffixMatches(List<T> lookFor, List<T> inList, ListMemberComparator<T> comparator) { if (lookFor.isEmpty() || lookFor.size() > inList.size()) return null; List<T> relevantInList = ArraysUtils.sameLengthSuffix(inList, lookFor); List<T> relevantInListWithoutFirst = ArraysUtils.sublistWithoutFirst(relevantInList); List<T> lookForWithoutFirst = ArraysUtils.sublistWithoutFirst(lookFor); if (!equals(lookForWithoutFirst, relevantInListWithoutFirst, comparator)) return null; boolean isSuffix = comparator.suffix(ArraysUtils.first(lookFor), ArraysUtils.first(relevantInList)); if (isSuffix) return new MatchMarker<T>(ArraysUtils.first(relevantInList), ArraysUtils.last(relevantInList), false); return null; }
public static void main(String[] args) throws Less4jException { basicFileExample(); customCssLocationExample1(); customCssLocationExample2(); guessedCssLocationExample1(); guessedCssLocationExample2(); customFunctionExample(); }
public <T> T prefixEnd(List<T> lookFor, List<T> inList, ListMemberComparator<T> comparator) { if (lookFor.isEmpty()) return inList.isEmpty() ? null : inList.get(0); if (lookFor.size() > inList.size()) return null; List<T> relevantInList = ArraysUtils.sameLengthPrefix(inList, lookFor); List<T> relevantInListWithoutLast = ArraysUtils.sublistWithoutLast(relevantInList); List<T> lookForWithoutLast = ArraysUtils.sublistWithoutLast(lookFor); if (!equals(lookForWithoutLast, relevantInListWithoutLast, comparator)) return null; if (comparator.prefix(ArraysUtils.last(lookFor), ArraysUtils.last(relevantInList))) return ArraysUtils.last(relevantInList); return null; }
private FixedNamePart toFixedName(Expression value, HiddenTokenAwareTree parent, VariableNamePart part) { CssPrinter printer = new QuotesKeepingInStringCssPrinter(); printer.append(value); // property based alternative would be nice, but does not seem to be needed FixedNamePart fixedName = new FixedNamePart(parent, printer.toString()); return fixedName; }
public Object getClone(PubliclyCloneable a) throws TotallyFooException { if (a == null) { throw new TotallyFooException(); } else { return a.clone(); } }
private <T> List<MatchMarker<T>> collectMatches(T lookFor, List<T> inParts, ListMemberComparator<T> comparator, List<MatchMarker<T>> result) { for (T inPart : inParts) { if (comparator.contains(lookFor, inPart)) result.add(new MatchMarker<T>(inPart, inPart, false)); } return result; }
public <T> boolean prefix(List<T> lookFor, List<T> inList, ListMemberComparator<T> comparator) { if (lookFor.isEmpty()) return true; if (lookFor.size() > inList.size()) return false; int beforeLast = lookFor.size() - 1; if (!equals(lookFor, inList, beforeLast, comparator)) return false; return comparator.prefix(lookFor.get(beforeLast), inList.get(beforeLast)); }
/** * Decodes data from Base64 notation, automatically * detecting gzip-compressed data and decompressing it. * * @param s the string to decode * @return the decoded data * @throws java.io.IOException If there is a problem * @since 1.4 */ public static byte[] decode( String s ) throws java.io.IOException { return decode( s, NO_OPTIONS ); }
public static <T> int count(Collection<T> collection, Filter<T> filter) { int result = 0; for (T t : collection) { if (filter.accept(t)) result++; } return result; }
private boolean containsInList(List<SelectorPart> lookForParts, List<SelectorPart> inSelectorParts) { boolean contains = listsComparator.contains(lookForParts, inSelectorParts, selectorPartsComparator); return contains; }
protected boolean equals(Double value, Double value2) { return MathUtils.equals(value, value2); }
public static String normalizeNoEndSeparator(String filename) { return doNormalize(filename, SYSTEM_SEPARATOR, false); }
public <T> boolean suffix(List<T> lookFor, List<T> inList, ListMemberComparator<T> comparator) { return null != suffixMatches(lookFor, inList, comparator); }
private String toError(Problem warning, SourceNamePrinter sourceNamePrinter) { return "ERROR " + toString(warning, sourceNamePrinter); }