List<Function<String, Reader>> fs = Arrays.asList(
(String s) -> new BufferedReader(new StringReader(s)),
(String s) -> new LineNumberReader(new StringReader(s)),
(String s) -> new CharArrayReader(s.toCharArray()),
(String s) -> new InputStreamReader(new ByteArrayInputStream(s.getBytes())),
(String s) -> newFileReader(s),
(String s) -> new PushbackReader(new StringReader(s)),
(String s) -> newPipedReader(s),
(String s) -> new StringReader(s)
);
// The easiest way to produce a cartesian product from a small fixed number of sets
List<Object[]> tuples = Collections.synchronizedList(new LinkedList<>()); for (Integer len : lens) for (Integer off : offs) for (String s : contents) for (Integer size : sizes) for (Function<String, Reader> f : fs)
tuples.add(new Object[]{f.apply(s), size, off, len});
return tuples.iterator();
}
privatevoid read(Reader r, int size, int off, int len) throws IOException {
IndexOutOfBoundsException ex = null; try {
r.read(newchar[size], off, len);
} catch (IndexOutOfBoundsException e) {
ex = e;
}
boolean incorrectBounds = off < 0 || len < 0 || len > size - off; boolean exceptionThrown = ex != null;
// // To avoid myriads of tiny files a cache is used. // ConcurrentHashMap.computeIfAbsent promises a crucial thing: // // ...The entire method invocation is performed atomically, so the // function is applied at most once per key... // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // privatefinal ConcurrentHashMap<String, File> cache = new ConcurrentHashMap<>();
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.