Class SystemTools
java.lang.Object
io.clonecloudstore.common.standard.system.SystemTools
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ThreadFactorystatic final ExecutorServicestatic final ExecutorServiceGlobal Thread pool for Internal actions such as in TeeInputStream, ZstdCompressedInputStream, S3 -
Method Summary
Modifier and TypeMethodDescriptionstatic longconsumeAll(Iterator<?> iterator) static longconsumeAll(Stream<?> stream) static voidconsumeWhileErrorInputStream(InputStream inputStream) Consume all InputStream in error case with no errorstatic voidconsumeWhileErrorInputStream(InputStream inputStream, long timeout) Consume all InputStream in error case with no error with a timeoutstatic ObjectGet the field from the object named fieldName from Classstatic IOExceptionsilentlyClose(InputStream inputStream) Silently close InputStream (exception is returned if any)static IOExceptionsilentlyClose(OutputStream outputStream) Silently close OutputStream (exception is returned if any)static voidsilentlyCloseNoException(InputStream inputStream) Silently close InputStream (no exception)static voidsilentlyCloseNoException(OutputStream outputStream) Silently close OutputStream (no exception)static longskip(InputStream inputStream, long skip) Skip bytes from InputStreamstatic Instantstatic longtransferTo(InputStream inputStream, OutputStream outputStream) Transfer all inputStream to outputStreamstatic longtransferTo(InputStream inputStream, OutputStream outputStream, boolean flushOnChunk) Transfer all inputStream to outputStreamstatic voidwait1ms()Thread.sleep(1 ms)
-
Field Details
-
VIRTUAL_EXECUTOR_SERVICE
Global Thread pool for Internal actions such as in TeeInputStream, ZstdCompressedInputStream, S3 -
DAEMON_THREAD_FACTORY
-
STANDARD_EXECUTOR_SERVICE
-
-
Method Details
-
toMillis
- Parameters:
instant- instant to truncate- Returns:
- an Instant truncated to Millisecond (since most of the DB truncated it)
-
silentlyCloseNoException
Silently close InputStream (no exception) -
silentlyClose
Silently close InputStream (exception is returned if any) -
silentlyCloseNoException
Silently close OutputStream (no exception) -
silentlyClose
Silently close OutputStream (exception is returned if any) -
consumeAll
- Parameters:
iterator- to consume fully- Returns:
- the number of items consumed
-
consumeAll
- Parameters:
stream- to consume fully- Returns:
- the number of items consumed
-
getField
public static Object getField(Class<?> clasz, String fieldName, Object object) throws NoSuchFieldException, IllegalAccessException Get the field from the object named fieldName from Class- Throws:
NoSuchFieldException- field does not existIllegalAccessException- issue on access
-
wait1ms
public static void wait1ms()Thread.sleep(1 ms) -
consumeWhileErrorInputStream
Consume all InputStream in error case with no error -
consumeWhileErrorInputStream
Consume all InputStream in error case with no error with a timeout -
transferTo
public static long transferTo(InputStream inputStream, OutputStream outputStream) throws IOException Transfer all inputStream to outputStream- Returns:
- length of transferred bytes
- Throws:
IOException
-
transferTo
public static long transferTo(InputStream inputStream, OutputStream outputStream, boolean flushOnChunk) throws IOException Transfer all inputStream to outputStream- Returns:
- length of transferred bytes
- Throws:
IOException
-
skip
Skip bytes from InputStream- Returns:
- the number of really skipped bytes
- Throws:
IOException
-