jdk/src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template
changeset 36933 3e6453e2d833
parent 36222 dfed693e648b
equal deleted inserted replaced
36930:74e9f4b90006 36933:3e6453e2d833
   138         }
   138         }
   139         cleaner = Cleaner.create(this, new Deallocator(base, size, cap));
   139         cleaner = Cleaner.create(this, new Deallocator(base, size, cap));
   140         att = null;
   140         att = null;
   141 #else[rw]
   141 #else[rw]
   142         super(cap);
   142         super(cap);
       
   143         this.isReadOnly = true;
   143 #end[rw]
   144 #end[rw]
   144     }
   145     }
   145 
   146 
   146 #if[rw]
   147 #if[rw]
   147 
   148 
   178         address = addr;
   179         address = addr;
   179         cleaner = Cleaner.create(this, unmapper);
   180         cleaner = Cleaner.create(this, unmapper);
   180         att = null;
   181         att = null;
   181 #else[rw]
   182 #else[rw]
   182         super(cap, addr, fd, unmapper);
   183         super(cap, addr, fd, unmapper);
       
   184         this.isReadOnly = true;
   183 #end[rw]
   185 #end[rw]
   184     }
   186     }
   185 
   187 
   186 #end[byte]
   188 #end[byte]
   187 
   189 
   198         cleaner = null;
   200         cleaner = null;
   199 #end[byte]
   201 #end[byte]
   200         att = db;
   202         att = db;
   201 #else[rw]
   203 #else[rw]
   202         super(db, mark, pos, lim, cap, off);
   204         super(db, mark, pos, lim, cap, off);
       
   205         this.isReadOnly = true;
   203 #end[rw]
   206 #end[rw]
   204     }
   207     }
   205 
   208 
   206     public $Type$Buffer slice() {
   209     public $Type$Buffer slice() {
   207         int pos = this.position();
   210         int pos = this.position();
   210         int rem = (pos <= lim ? lim - pos : 0);
   213         int rem = (pos <= lim ? lim - pos : 0);
   211         int off = (pos << $LG_BYTES_PER_VALUE$);
   214         int off = (pos << $LG_BYTES_PER_VALUE$);
   212         assert (off >= 0);
   215         assert (off >= 0);
   213         return new Direct$Type$Buffer$RW$$BO$(this, -1, 0, rem, rem, off);
   216         return new Direct$Type$Buffer$RW$$BO$(this, -1, 0, rem, rem, off);
   214     }
   217     }
       
   218 
       
   219 #if[byte]
       
   220     public $Type$Buffer slice(int pos, int lim) {
       
   221         assert (pos >= 0);
       
   222         assert (pos <= lim);
       
   223         int rem = lim - pos;
       
   224         return new Direct$Type$Buffer$RW$$BO$(this, -1, 0, rem, rem, pos);
       
   225     }
       
   226 #end[byte]
   215 
   227 
   216     public $Type$Buffer duplicate() {
   228     public $Type$Buffer duplicate() {
   217         return new Direct$Type$Buffer$RW$$BO$(this,
   229         return new Direct$Type$Buffer$RW$$BO$(this,
   218                                               this.markValue(),
   230                                               this.markValue(),
   219                                               this.position(),
   231                                               this.position(),