/[classpath]/classpath/java/nio/Buffer.java
ViewVC logotype

Diff of /classpath/java/nio/Buffer.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by rveldema, Mon Mar 11 15:46:36 2002 UTC revision 1.2 by rveldema, Tue Mar 12 11:36:22 2002 UTC
# Line 1  Line 1 
1  package java.nio;  package java.nio;
2    
3    
4  abstract class Buffer  public abstract class Buffer
5  {  {
6      int cap, limit, pos, mark;      int cap, limit, pos, mark;
7    
# Line 9  abstract class Buffer Line 9  abstract class Buffer
9      {      {
10      }      }
11    
12      final int capacity()      public final int capacity()
13      {      {
14          return cap;          return cap;
15      }      }
16    
17      final Buffer clear()      public final int capacity(int c)
18        {
19            int old = cap;
20            cap = c;
21            return old;
22        }
23    
24        public final Buffer clear()
25      {      {
26          limit = cap;          limit = cap;
27          mark = 0;          mark = 0;
# Line 22  abstract class Buffer Line 29  abstract class Buffer
29          return this;          return this;
30      }      }
31            
32      final Buffer flip()      public final Buffer flip()
33      {      {
34          limit = pos;          limit = pos;
35          pos = 0;          pos = 0;
# Line 32  abstract class Buffer Line 39  abstract class Buffer
39          return this;          return this;
40      }      }
41            
42      final boolean hasRemaining()      public final boolean hasRemaining()
43      {      {
44          return limit > pos;          return limit > pos;
45      }      }
46    
47      abstract  boolean isReadOnly();          public abstract  boolean isReadOnly();    
48            
49            
50      final int limit()      public final int limit()
51      {      {
52          return limit;          return limit;
53      }      }
54    
55      final Buffer limit(int newLimit)      public final Buffer limit(int newLimit)
56      {      {
57          if (newLimit <= mark)          if (newLimit <= mark)
58              mark = 0;              mark = 0;
# Line 57  abstract class Buffer Line 64  abstract class Buffer
64          return this;          return this;
65      }      }
66    
67      final Buffer mark()      public final Buffer mark()
68      {      {
69          mark = pos;          mark = pos;
70          return this;          return this;
71      }      }
72    
73      final int position()      public final int position()
74      {      {
75          return pos;          return pos;
76      }      }
77            
78    
79      final Buffer position(int newPosition)      public final Buffer position(int newPosition)
80      {      {
81          /// If the mark is defined and larger than the new          /// If the mark is defined and larger than the new
82    
# Line 80  abstract class Buffer Line 87  abstract class Buffer
87          return this;          return this;
88      }      }
89    
90      final int remaining()      public final int remaining()
91      {      {
92          return limit - pos;          return limit - pos;
93      }      }
94    
95      final Buffer reset()      public final Buffer reset()
96      {      {
97          pos = mark;          pos = mark;
98          return this;          return this;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26