/** * Create a new ConcurrentModificationException. * * @param message the message * @return the exception */ public static ConcurrentModificationException newConcurrentModificationException(String message) { return new ConcurrentModificationException(formatMessage(0, message)); }
/** * Create a new UnsupportedOperationException. * * @param message the message * @return the exception */ public static UnsupportedOperationException newUnsupportedOperationException(String message) { return new UnsupportedOperationException(formatMessage(0, message)); }
/** * Create a new IllegalStateException. * * @param errorCode the error code * @param message the message * @param arguments the arguments * @return the exception */ public static IllegalStateException newIllegalStateException(int errorCode, String message, Object... arguments) { return initCause(new IllegalStateException(formatMessage(errorCode, message, arguments)), arguments); }
/** * Create a new IllegalArgumentException. * * @param message the message * @param arguments the arguments * @return the exception */ public static IllegalArgumentException newIllegalArgumentException(String message, Object... arguments) { return initCause(new IllegalArgumentException(formatMessage(0, message, arguments)), arguments); }
@Override public int read(byte[] b, int off, int len) throws IOException { if (len <= 0) { return 0; } while (true) { if (buffer == null) { try { buffer = nextBuffer(); } catch (IllegalStateException e) { String msg = DataUtils.formatMessage(DataUtils.ERROR_BLOCK_NOT_FOUND, "Block not found in id {0}", Arrays.toString(idBuffer.array())); throw new IOException(msg, e); } if (buffer == null) { return -1; } } int result = buffer.read(b, off, len); if (result > 0) { pos += result; return result; } buffer = null; } }