Package com.google.cloud.hadoop.util
Class IoExceptionHelper
- java.lang.Object
-
- com.google.cloud.hadoop.util.IoExceptionHelper
-
public final class IoExceptionHelper extends Object
Translates exceptions from API calls into higher-level meaning, while allowing injectability for testing how API errors are handled.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisIoError(Throwable throwable)Determines if a givenThrowableis caused by an IO error.static booleanisReadTimedOut(IOException e)Determines if a givenIOExceptionis caused by a timed out read.static booleanisSocketError(Throwable throwable)Determines if a givenThrowableis caused by a socket error.
-
-
-
Method Detail
-
isIoError
public static boolean isIoError(Throwable throwable)
Determines if a givenThrowableis caused by an IO error.Recursively checks
getCause()if outer exception isn't an instance of the correct class.
-
isSocketError
public static boolean isSocketError(Throwable throwable)
Determines if a givenThrowableis caused by a socket error.Recursively checks
getCause()if outer exception isn't an instance of the correct class.
-
isReadTimedOut
public static boolean isReadTimedOut(IOException e)
Determines if a givenIOExceptionis caused by a timed out read.- Parameters:
e- TheIOExceptionto check.- Returns:
- True if the
IOExceptionis a result of a read timeout.
-
-