public class Util extends Object
| Modifier and Type | Field and Description |
|---|---|
static ThreadLocal<Random> |
R
The constant R.
|
| Constructor and Description |
|---|
Util() |
| Modifier and Type | Method and Description |
|---|---|
static void |
add(java.util.function.DoubleSupplier f,
double[] data)
Add.
|
static java.util.stream.Stream<byte[]> |
binaryStream(String path,
String name,
int skip,
int recordSize)
Binary stream stream.
|
static <F,T> java.util.function.Function<F,T> |
cache(java.util.function.Function<F,T> inner)
Cache function.
|
static InputStream |
cache(String url,
String file)
Cache input stream.
|
static File |
cacheFile(String url,
String file)
Cache file file.
|
static File |
cacheFile(URI url)
Cache file file.
|
static InputStream |
cacheStream(String url,
String file)
Cache input stream.
|
static InputStream |
cacheStream(URI url)
Cache input stream.
|
static CharSequence[] |
currentStack()
Current stack string [ ].
|
static java.time.temporal.TemporalUnit |
cvt(TimeUnit units)
Cvt temporal unit.
|
static String |
dateStr(String formatStr)
Date str string.
|
static InputStream |
get(String url)
Get input stream.
|
static <T> T |
getLast(java.util.stream.Stream<T> stream)
Gets last.
|
static void |
layout(Component c)
Layout.
|
static BufferedImage |
maximumSize(BufferedImage image,
int width)
Resize buffered image.
|
static String |
mkString(CharSequence separator,
CharSequence... strs)
Mk string string.
|
static String |
pathTo(File from,
File to)
Path to string.
|
static byte[] |
read(DataInputStream i,
int s)
Read byte [ ].
|
static void |
report(CharSequence... fragments)
Report.
|
static void |
report(java.util.stream.Stream<CharSequence> fragments)
Report.
|
static void |
sleep(int i)
Sleep.
|
static BufferedImage |
toImage(Component component)
To image buffered image.
|
static CharSequence |
toInlineImage(BufferedImage img,
String alt)
To inline image string.
|
static CharSequence |
toInlineImage(LabeledObject<BufferedImage> img)
To inline image string.
|
static <T> java.util.stream.Stream<T> |
toIterator(Iterator<T> iterator)
To iterator stream.
|
static <T> java.util.stream.Stream<T> |
toStream(Iterator<T> iterator)
To stream stream.
|
static <T> java.util.stream.Stream<T> |
toStream(Iterator<T> iterator,
int size)
To stream stream.
|
static <T> java.util.stream.Stream<T> |
toStream(Iterator<T> iterator,
int size,
boolean parallel)
To stream stream.
|
static UUID |
uuid()
Uuid uuid.
|
public static final ThreadLocal<Random> R
public static void add(@Nonnull java.util.function.DoubleSupplier f, @Nonnull double[] data)
f - the fdata - the datapublic static java.util.stream.Stream<byte[]> binaryStream(String path, @Nonnull String name, int skip, int recordSize) throws IOException
path - the pathname - the nameskip - the skiprecordSize - the record sizeIOException - the io exceptionpublic static <F,T> java.util.function.Function<F,T> cache(@Nonnull java.util.function.Function<F,T> inner)
F - the type parameterT - the type parameterinner - the heapCopypublic static InputStream cache(String url, String file) throws IOException, NoSuchAlgorithmException, KeyManagementException
url - the urlfile - the fileIOException - the io exceptionNoSuchAlgorithmException - the no such algorithm exceptionKeyManagementException - the key management exceptionpublic static InputStream cacheStream(@Nonnull String url, @Nonnull String file) throws IOException, NoSuchAlgorithmException, KeyManagementException
url - the urlfile - the fileIOException - the io exceptionNoSuchAlgorithmException - the no such algorithm exceptionKeyManagementException - the key management exceptionpublic static File cacheFile(@Nonnull String url, @Nonnull String file) throws IOException, NoSuchAlgorithmException, KeyManagementException
url - the urlfile - the fileIOException - the io exceptionNoSuchAlgorithmException - the no such algorithm exceptionKeyManagementException - the key management exceptionpublic static InputStream get(@Nonnull String url) throws NoSuchAlgorithmException, KeyManagementException, IOException
url - the urlNoSuchAlgorithmException - the no such algorithm exceptionKeyManagementException - the key management exceptionIOException - the io exceptionpublic static InputStream cacheStream(@Nonnull URI url) throws IOException, NoSuchAlgorithmException, KeyManagementException
url - the urlIOException - the io exceptionNoSuchAlgorithmException - the no such algorithm exceptionKeyManagementException - the key management exceptionpublic static File cacheFile(@Nonnull URI url) throws IOException, NoSuchAlgorithmException, KeyManagementException
url - the urlIOException - the io exceptionNoSuchAlgorithmException - the no such algorithm exceptionKeyManagementException - the key management exceptionpublic static CharSequence[] currentStack()
@Nonnull public static java.time.temporal.TemporalUnit cvt(@Nonnull TimeUnit units)
units - the unitspublic static <T> T getLast(@Nonnull java.util.stream.Stream<T> stream)
T - the type parameterstream - the streampublic static String mkString(@Nonnull CharSequence separator, CharSequence... strs)
separator - the separatorstrs - the strspublic static String pathTo(@Nonnull File from, @Nonnull File to)
from - the fromto - the to@Nonnull public static byte[] read(@Nonnull DataInputStream i, int s) throws IOException
i - thes - the sIOException - the io exceptionpublic static void report(@Nonnull java.util.stream.Stream<CharSequence> fragments) throws IOException
fragments - the fragmentsIOException - the io exceptionpublic static void report(CharSequence... fragments) throws IOException
fragments - the fragmentsIOException - the io exception@Nullable public static BufferedImage maximumSize(@Nullable BufferedImage image, int width)
image - the imagewidth - public static BufferedImage toImage(@Nonnull Component component)
component - the componentpublic static CharSequence toInlineImage(BufferedImage img, String alt)
img - the imgalt - the altpublic static CharSequence toInlineImage(@Nonnull LabeledObject<BufferedImage> img)
img - the imgpublic static <T> java.util.stream.Stream<T> toIterator(@Nonnull Iterator<T> iterator)
T - the type parameteriterator - the iteratorpublic static <T> java.util.stream.Stream<T> toStream(@Nonnull Iterator<T> iterator)
T - the type parameteriterator - the iteratorpublic static <T> java.util.stream.Stream<T> toStream(@Nonnull Iterator<T> iterator, int size)
T - the type parameteriterator - the iteratorsize - the sizepublic static <T> java.util.stream.Stream<T> toStream(@Nonnull Iterator<T> iterator, int size, boolean parallel)
T - the type parameteriterator - the iteratorsize - the sizeparallel - the parallelpublic static UUID uuid()
public static void sleep(int i)
i - theCopyright © 2018 SimiaCryptus Software. All rights reserved.