aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/nio/Buffer.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/nio/Buffer.java')
-rw-r--r--libjava/java/nio/Buffer.java32
1 files changed, 27 insertions, 5 deletions
diff --git a/libjava/java/nio/Buffer.java b/libjava/java/nio/Buffer.java
index 9474fb453f0..7d291bedbc1 100644
--- a/libjava/java/nio/Buffer.java
+++ b/libjava/java/nio/Buffer.java
@@ -39,11 +39,33 @@ package java.nio;
public abstract class Buffer
{
- int cap = 0;
- int limit = 0;
- int pos = 0;
- int mark = -1;
-
+ private int cap = 0;
+ private int limit = 0;
+ private int pos = 0;
+ private int mark = -1;
+
+ // Creates a new Buffer.
+ //
+ // Should be package private.
+ //
+ Buffer (int capacity, int limit, int position, int mark)
+ {
+ if (capacity < 0)
+ throw new IllegalArgumentException ();
+
+ cap = capacity;
+ limit (limit);
+ position (position);
+
+ if (mark > 0)
+ {
+ if (mark > pos)
+ throw new IllegalArgumentException ();
+
+ this.mark = mark;
+ }
+ }
+
/**
* Retrieves the capacity of the buffer.
*/