Package java.nio

Examples of java.nio.ByteBuffer.arrayOffset()


    read_loop:
    for (int i = 0; err==JZlib.Z_OK && i < inbuf.size(); i++) {
     
      ByteBuffer bb = inbuf.get(i);
     
      inflater.setInput(bb.array(), bb.arrayOffset() + bb.position(), bb.remaining(), true);

      int in_size = bb.remaining();
      ByteBuffer out = ByteBuffer.allocate(1024);       
      do {
        long read_before = inflater.total_in;
View Full Code Here


      do {
        long read_before = inflater.total_in;
        long wrote_before = inflater.total_out;

        inflater.next_out = out.array();
        inflater.next_out_index = out.arrayOffset() + out.position();
        inflater.avail_out = out.remaining();
         
        err = inflater.inflate(flush_mode);

        if (err == JZlib.Z_OK || err == JZlib.Z_STREAM_END) {
View Full Code Here

    for (int i = 0; err==JZlib.Z_OK && i < inbuf.size(); i++) {

      ByteBuffer bb = inbuf.get(i);

      deflater.next_in = bb.array();
      deflater.next_in_index = bb.arrayOffset() + bb.position();
      deflater.avail_in = bb.remaining();

  //    inf.setInput(bb.array(), bb.arrayOffset()+bb.position(), bb.limit());

      int in_size = bb.remaining();
View Full Code Here

        long read_before = deflater.total_in;
        long wrote_before = deflater.total_out;

        deflater.next_out = out.array();
        deflater.next_out_index = out.arrayOffset() + out.position();
        deflater.avail_out = out.remaining();

        err = deflater.deflate(flush_mode);

        if (err == JZlib.Z_OK || err == JZlib.Z_STREAM_END) {
View Full Code Here

        return ERT.NIL;

    } else {

      bb.flip();
      return EString.make(bb.array(), bb.arrayOffset() + bb.position(), bb.remaining());
    }
  }

  /**
   * @param out
View Full Code Here

        writeOut(ZipLong.getBytes(Math.min(cdOffset, ZIP64_MAGIC)));

        // ZIP file comment
        ByteBuffer data = this.zipEncoding.encode(comment);
        writeOut(ZipShort.getBytes(data.limit()));
        writeOut(data.array(), data.arrayOffset(),
                 data.limit() - data.position());
    }

    /**
     * Convert a Date object to a DOS date/time field.
View Full Code Here

    protected byte[] getBytes(String name) throws ZipException {
        try {
            ByteBuffer b =
                ZipEncodingHelper.getZipEncoding(encoding).encode(name);
            byte[] result = new byte[b.limit()];
            System.arraycopy(b.array(), b.arrayOffset(), result, 0,
                             result.length);
            return result;
        } catch (IOException ex) {
            throw new ZipException("Failed to encode name: " + ex.getMessage());
        }
View Full Code Here

        byte[] extra = ze.getLocalFileDataExtra();
        writeOut(ZipShort.getBytes(extra.length));
        written += SHORT;

        // file name
        writeOut(name.array(), name.arrayOffset(),
                 name.limit() - name.position());
        written += name.limit();

        // extra field
        writeOut(extra);
View Full Code Here

            if (createUnicodeExtraFields == UnicodeExtraFieldPolicy.ALWAYS
                || !commentEncodable) {
                ByteBuffer commentB = getEntryEncoding(ze).encode(comm);
                ze.addExtraField(new UnicodeCommentExtraField(comm,
                                                              commentB.array(),
                                                              commentB.arrayOffset(),
                                                              commentB.limit()
                                                              - commentB.position())
                                 );
            }
        }
View Full Code Here

        // extra field
        writeOut(extra);
        written += extra.length;

        // file comment
        writeOut(commentB.array(), commentB.arrayOffset(),
                 commentB.limit() - commentB.position());
        written += commentB.limit();
    }

    /**
 
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.