Package org.robolectric.util
Class Util
java.lang.Object
org.robolectric.util.Util
Generic collection of utility methods.
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic voidcopy(InputStream in, OutputStream out) static Filestatic Filestatic intReturns the Java version as an int value.static intstatic Pathstatic byte[]readBytes(InputStream is) This method consumes an input stream and returns its content, and closes it.static <T> T[]reverse(T[] array) static <T extends Throwable>
RuntimeExceptionRe-throwt(even if it's a checked exception) without requiring athrowsdeclaration. 
- 
Constructor Details
- 
Util
public Util() 
 - 
 - 
Method Details
- 
getJavaVersion
public static int getJavaVersion()Returns the Java version as an int value.- Returns:
 - the Java version as an int value (8, 9, etc.)
 
 - 
copy
- Throws:
 IOException
 - 
readBytes
This method consumes an input stream and returns its content, and closes it.- Parameters:
 is- The input stream to read from.- Returns:
 - The bytes read from the stream.
 - Throws:
 IOException- Error reading from stream.
 - 
reverse
public static <T> T[] reverse(T[] array)  - 
file
 - 
file
 - 
pathFrom
 - 
parseInt
 - 
sneakyThrow
Re-throwt(even if it's a checked exception) without requiring athrowsdeclaration.This function declares a return type of
RuntimeExceptionbut will never actually return a value. This allows you to use it with athrowstatement to convince the compiler that the current branch will not complete.throw Util.sneakyThrow(new IOException());Adapted from https://www.mail-archive.com/javaposse@googlegroups.com/msg05984.html
- Throws:
 T extends Throwable
 
 -