< prev index next >

src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template

Print this page




 150         cleaner = null;
 151         att = ob;
 152     }
 153 
 154 
 155     // Invoked only by JNI: NewDirectByteBuffer(void*, long)
 156     //
 157     private Direct$Type$Buffer(long addr, int cap) {
 158         super(-1, 0, cap, cap);
 159         address = addr;
 160         cleaner = null;
 161         att = null;
 162     }
 163 
 164 #end[rw]
 165 
 166     // For memory-mapped buffers -- invoked by FileChannelImpl via reflection
 167     //
 168     protected Direct$Type$Buffer$RW$(int cap, long addr,
 169                                      FileDescriptor fd,
 170                                      Runnable unmapper)

 171     {
 172 #if[rw]
 173         super(-1, 0, cap, cap, fd);
 174         address = addr;
 175         cleaner = Cleaner.create(this, unmapper);
 176         att = null;
 177 #else[rw]
 178         super(cap, addr, fd, unmapper);
 179         this.isReadOnly = true;
 180 #end[rw]
 181     }
 182 
 183 #end[byte]
 184 
 185     // For duplicates and slices
 186     //
 187     Direct$Type$Buffer$RW$$BO$(DirectBuffer db,         // package-private
 188                                int mark, int pos, int lim, int cap,
 189                                int off)
 190     {
 191 #if[rw]
 192         super(mark, pos, lim, cap);
 193         address = db.address() + off;
 194 #if[byte]
 195         cleaner = null;
 196 #end[byte]
 197         Object attachment = db.attachment();
 198         att = (attachment == null ? db : attachment);




 150         cleaner = null;
 151         att = ob;
 152     }
 153 
 154 
 155     // Invoked only by JNI: NewDirectByteBuffer(void*, long)
 156     //
 157     private Direct$Type$Buffer(long addr, int cap) {
 158         super(-1, 0, cap, cap);
 159         address = addr;
 160         cleaner = null;
 161         att = null;
 162     }
 163 
 164 #end[rw]
 165 
 166     // For memory-mapped buffers -- invoked by FileChannelImpl via reflection
 167     //
 168     protected Direct$Type$Buffer$RW$(int cap, long addr,
 169                                      FileDescriptor fd,
 170                                      Runnable unmapper,
 171                                      boolean isPersistent)
 172     {
 173 #if[rw]
 174         super(-1, 0, cap, cap, fd, isPersistent);
 175         address = addr;
 176         cleaner = Cleaner.create(this, unmapper);
 177         att = null;
 178 #else[rw]
 179         super(cap, addr, fd, unmapper, isPersistent);
 180         this.isReadOnly = true;
 181 #end[rw]
 182     }
 183 
 184 #end[byte]
 185 
 186     // For duplicates and slices
 187     //
 188     Direct$Type$Buffer$RW$$BO$(DirectBuffer db,         // package-private
 189                                int mark, int pos, int lim, int cap,
 190                                int off)
 191     {
 192 #if[rw]
 193         super(mark, pos, lim, cap);
 194         address = db.address() + off;
 195 #if[byte]
 196         cleaner = null;
 197 #end[byte]
 198         Object attachment = db.attachment();
 199         att = (attachment == null ? db : attachment);


< prev index next >