Examples of slice()


Examples of java.nio.ByteBuffer.slice()

    OutputWireRecord(EnvironmentImpl envImpl, LogItem logItem) {
        this.envImpl = envImpl;
        header = logItem.getHeader();
        ByteBuffer buffer = logItem.getBuffer();
        buffer.position(header.getSize());
        entryBuffer = buffer.slice();
        assert entryBuffer.limit() == header.getItemSize() :
            "Limit:" + entryBuffer.limit() + " size:" + header.getItemSize();
    }

    /* For unit test support. */
 
View Full Code Here

Examples of java.nio.ByteBuffer.slice()

                }

                buffer.limit(buffer.position() + length);
                return new Segment(
                        FileStore.this, id,
                        buffer.slice(), referencedIds);
            }
        }

        throw new IllegalStateException("Segment " + id + " not found");
    }
View Full Code Here

Examples of java.nio.ByteBuffer.slice()

    @Override
    public ByteBuffer read(int position, int length) {
        ByteBuffer entry = buffer.asReadOnlyBuffer();
        entry.position(position);
        entry.limit(position + length);
        return entry.slice();
    }

    @Override
    public void write(int position, byte[] b, int offset, int length)
            throws IOException {
View Full Code Here

Examples of java.nio.ByteBuffer.slice()

            buffer.putLong(ledgerId);
            buffer.putLong(i);
            buffer.putLong(0);
            buffer.put(passwd);
            buffer.rewind();
            ChannelBuffer toSend = ChannelBuffers.wrappedBuffer(ChannelBuffers.wrappedBuffer(buffer.slice()), ChannelBuffers.wrappedBuffer(data));
            bkc.addEntry(addr, ledgerId, passwd, i, toSend, callback, System.currentTimeMillis(), 0);
        }

    }
View Full Code Here

Examples of java.nio.ByteBuffer.slice()

    public int getContent(ByteBuffer buf, int offset)
    {
        ByteBuffer src = _content.duplicate();
        src.position(offset);
        src = src.slice();
        int len = src.remaining();
        if(len > buf.remaining())
        {
            len = buf.remaining();
        }
View Full Code Here

Examples of java.nio.CharBuffer.slice()

                        buf.array(),
                        buf.arrayOffset() + buf.position() + offset,
                        length, charset);
            }

            buf = buf.slice();
            buf.limit(length);
            buf.position(offset);
            return copiedBuffer(endianness, buf, charset);
        }
View Full Code Here

Examples of java.nio.IntBuffer.slice()

  @Override
  public double getQuick(int rowIndex, int columnIndex) {
    IntBuffer tmp = data.get(bufferIndex[rowIndex]).asReadOnlyBuffer();
    tmp.position(rowOffset[rowIndex]);
    tmp.limit(rowSize[rowIndex]);
    tmp = tmp.slice();
    return searchForIndex(tmp, columnIndex);
  }

  private static double searchForIndex(IntBuffer row, int columnIndex) {
    int high = row.limit();
View Full Code Here

Examples of java.nio.MappedByteBuffer.slice()

        }
       
        segBuffer.position(segOff);
        segBuffer.limit(segOff + blockSize);
       
        ByteBuffer toReturn = segBuffer.slice();
       
        segBuffer.limit(segBuffer.capacity());
       
        return toReturn;
    }
View Full Code Here

Examples of jnr.ffi.Pointer.slice()

        Pointer ptr = posix.getRuntime().getMemoryManager().allocateDirect(totalSize);

        int offset = 0;
        for (int i = 0; i < dataLengths.length; ++i) {
            int eachLen = posix.socketMacros().CMSG_SPACE(dataLengths[i]);
            CmsgHdr each = allocateCmsgHdrInternal(posix, ptr.slice(offset, eachLen), eachLen);
            cmsgs[i] = each;
            offset += eachLen;
        }

        setControlPointer(ptr);
View Full Code Here

Examples of mikera.arrayz.Array.slice()

    if (dim==0) {
      return SliceArray.create(al,shp);
    } else {
      Array a=Array.newArray(shp);
      for (int i=0; i<n; i++) {
        a.slice(dim, i).set(al.get(i));
      }
      return a;
    }
  } 
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.