/** * @return the value wrapped by this {@code Optional} * @throws NullPointerException if this is empty (contains no value) */ public T get() { Preconditions.checkNotNull(value); return value; }
private void checkReadException() throws IOException { if (readAborted) { Throwables.propagateIfPossible(readException, IOException.class); throw new IOException(readException); } }
/** * Creates a <code>ReadAheadInputStream</code> with the specified buffer size and read-ahead * threshold * * @param inputStream The underlying input stream. * @param bufferSizeInBytes The buffer size. */ public ReadAheadInputStream( InputStream inputStream, int bufferSizeInBytes) { Preconditions.checkArgument(bufferSizeInBytes > 0, "bufferSizeInBytes should be greater than 0, but the value is " + bufferSizeInBytes); activeBuffer = ByteBuffer.allocate(bufferSizeInBytes); readAheadBuffer = ByteBuffer.allocate(bufferSizeInBytes); this.underlyingInputStream = inputStream; activeBuffer.flip(); readAheadBuffer.flip(); }
@Override public String toString() { return Objects.toStringHelper(this) .add("streamId", streamId) .add("chunkIndex", chunkIndex) .toString(); } }
public static <E extends Enum<E>> E parseIgnoreCase(Class<E> clz, String str) { E[] constants = clz.getEnumConstants(); if (str == null) { return null; } for (E e : constants) { if (e.name().equalsIgnoreCase(str)) { return e; } } throw new IllegalArgumentException( String.format("Illegal type='%s'. Supported type values: %s", str, Joiner.on(", ").join(constants))); } }
@Override public String toString() { return Objects.toStringHelper(this) .add("buf", buf) .toString(); } }
private Optional(T value) { Preconditions.checkNotNull(value); this.value = value; }
public static <E extends Enum<E>> E parseIgnoreCase(Class<E> clz, String str) { E[] constants = clz.getEnumConstants(); if (str == null) { return null; } for (E e : constants) { if (e.name().equalsIgnoreCase(str)) { return e; } } throw new IllegalArgumentException( String.format("Illegal type='%s'. Supported type values: %s", str, Joiner.on(", ").join(constants))); } }
/** * Creates a <code>ReadAheadInputStream</code> with the specified buffer size and read-ahead * threshold * * @param inputStream The underlying input stream. * @param bufferSizeInBytes The buffer size. */ public ReadAheadInputStream( InputStream inputStream, int bufferSizeInBytes) { Preconditions.checkArgument(bufferSizeInBytes > 0, "bufferSizeInBytes should be greater than 0, but the value is " + bufferSizeInBytes); activeBuffer = ByteBuffer.allocate(bufferSizeInBytes); readAheadBuffer = ByteBuffer.allocate(bufferSizeInBytes); this.underlyingInputStream = inputStream; activeBuffer.flip(); readAheadBuffer.flip(); }
private void checkReadException() throws IOException { if (readAborted) { Throwables.propagateIfPossible(readException, IOException.class); throw new IOException(readException); } }
@Override public String toString() { return Objects.toStringHelper(this) .add("streamId", streamId) .toString(); }
private Optional(T value) { Preconditions.checkNotNull(value); this.value = value; }
public static <E extends Enum<E>> E parseIgnoreCase(Class<E> clz, String str) { E[] constants = clz.getEnumConstants(); if (str == null) { return null; } for (E e : constants) { if (e.name().equalsIgnoreCase(str)) { return e; } } throw new IllegalArgumentException( String.format("Illegal type='%s'. Supported type values: %s", str, Joiner.on(", ").join(constants))); } }
@Override public String toString() { return Objects.toStringHelper(this) .add("buf", buf) .toString(); } }
/** * @return the value wrapped by this {@code Optional} * @throws NullPointerException if this is empty (contains no value) */ public T get() { Preconditions.checkNotNull(value); return value; }
@Override public String toString() { return Objects.toStringHelper(this) .add("blockId", blockId) .add("metadata size", metadata.length) .toString(); }
/** * @return the value wrapped by this {@code Optional} * @throws NullPointerException if this is empty (contains no value) */ public T get() { Preconditions.checkNotNull(value); return value; }
private Optional(T value) { Preconditions.checkNotNull(value); this.value = value; }
@Override public String toString() { return Objects.toStringHelper(this) .add("appId", appId) .add("execId", execId) .add("executorInfo", executorInfo) .toString(); }