| Index: components/cronet/android/api/src/org/chromium/net/Preconditions.java
|
| diff --git a/components/cronet/android/api/src/org/chromium/net/Preconditions.java b/components/cronet/android/api/src/org/chromium/net/Preconditions.java
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..babce3745ec1f61ef89331a4fc5eff5822a8a345
|
| --- /dev/null
|
| +++ b/components/cronet/android/api/src/org/chromium/net/Preconditions.java
|
| @@ -0,0 +1,23 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +package org.chromium.net;
|
| +
|
| +import java.nio.ByteBuffer;
|
| +
|
| +final class Preconditions {
|
| + private Preconditions() {}
|
| +
|
| + static void checkDirect(ByteBuffer buffer) {
|
| + if (!buffer.isDirect()) {
|
| + throw new IllegalArgumentException("byteBuffer must be a direct ByteBuffer.");
|
| + }
|
| + }
|
| +
|
| + static void checkHasRemaining(ByteBuffer buffer) {
|
| + if (!buffer.hasRemaining()) {
|
| + throw new IllegalArgumentException("ByteBuffer is already full.");
|
| + }
|
| + }
|
| +}
|
|
|