Package java.nio

Examples of java.nio.ByteBuffer.order()


    return wavedata;
  }

  private static ByteBuffer convertAudioBytes(byte[] audio_bytes, boolean two_bytes_data) {
    ByteBuffer dest = ByteBuffer.allocateDirect(audio_bytes.length);
    dest.order(ByteOrder.nativeOrder());
    ByteBuffer src = ByteBuffer.wrap(audio_bytes);
    src.order(ByteOrder.LITTLE_ENDIAN);
    if (two_bytes_data) {
      ShortBuffer dest_short = dest.asShortBuffer();
      ShortBuffer src_short = src.asShortBuffer();
View Full Code Here


  private static ByteBuffer convertAudioBytes(byte[] audio_bytes, boolean two_bytes_data) {
    ByteBuffer dest = ByteBuffer.allocateDirect(audio_bytes.length);
    dest.order(ByteOrder.nativeOrder());
    ByteBuffer src = ByteBuffer.wrap(audio_bytes);
    src.order(ByteOrder.LITTLE_ENDIAN);
    if (two_bytes_data) {
      ShortBuffer dest_short = dest.asShortBuffer();
      ShortBuffer src_short = src.asShortBuffer();
      while (src_short.hasRemaining())
        dest_short.put(src_short.get());
View Full Code Here

            if(usingVorbis) {
              buffer = ByteBuffer.allocateDirect(baos.size());
            } else {
              buffer = ByteBuffer.allocate(baos.size());
            }
            buffer.order(ByteOrder.nativeOrder());
            buffer.put(baos.toByteArray());
            buffer.rewind();
        } catch (Exception ioe) {
            ioe.printStackTrace();
        }
View Full Code Here

        // build a byte buffer from the temporary image
        // that be used by OpenGL to produce a texture.
        byte[] data = ((DataBufferByte) texImage.getRaster().getDataBuffer()).getData();

        imageBuffer = ByteBuffer.allocateDirect(data.length);
        imageBuffer.order(ByteOrder.nativeOrder());
        imageBuffer.put(data, 0, data.length);
        imageBuffer.flip();

        return imageBuffer;
    }
View Full Code Here

    ByteBuffer new_mapped_buffer = glMapBufferARB(GL_ARRAY_BUFFER_ARB,
                                                                  GL_WRITE_ONLY_ARB,
                                                                  mapped_buffer);
    if ( new_mapped_buffer != mapped_buffer )
      mapped_float_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asFloatBuffer();
    mapped_buffer = new_mapped_buffer;

    new_mapped_buffer = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
                                                       GL_WRITE_ONLY_ARB,
                                                       mapped_indices_buffer);
View Full Code Here

    new_mapped_buffer = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB,
                                                       GL_WRITE_ONLY_ARB,
                                                       mapped_indices_buffer);
    if ( new_mapped_buffer != mapped_indices_buffer )
      mapped_indices_int_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asIntBuffer();
    mapped_indices_buffer = new_mapped_buffer;

    mapped_float_buffer.rewind();
    vertices.rewind();
    mapped_float_buffer.put(vertices);
View Full Code Here

   * @param size how many int to contain
   * @return created IntBuffer
   */
  protected IntBuffer createIntBuffer(int size) {
    ByteBuffer temp = ByteBuffer.allocateDirect(4 * size);
    temp.order(ByteOrder.nativeOrder());

    return temp.asIntBuffer();
  }

  /**
 
View Full Code Here

        //done reading, close
        bis.close();
       
        // if ogg vorbis data, we need to pass it unmodified to alBufferData
        buffer = ByteBuffer.allocateDirect(baos.size());
        buffer.order(ByteOrder.nativeOrder());
        buffer.put(baos.toByteArray());
        buffer.rewind();
      } catch (Exception ioe) {
        ioe.printStackTrace();
      }
View Full Code Here

    glRotatef(angle, 0, 0, 1.0f);
    ByteBuffer new_mapped_buffer = glMapBufferARB(GL_ARRAY_BUFFER_ARB,
                                                                  GL_WRITE_ONLY_ARB,
                                                                  mapped_buffer);
    if ( new_mapped_buffer != mapped_buffer )
      mapped_float_buffer = new_mapped_buffer.order(ByteOrder.nativeOrder()).asFloatBuffer();
    mapped_buffer = new_mapped_buffer;
    mapped_float_buffer.rewind();
    vertices.rewind();
    mapped_float_buffer.put(vertices);
    if ( glUnmapBufferARB(GL_ARRAY_BUFFER_ARB) )
View Full Code Here

      final long original, final long seconds, final long nanos)
      throws IOException {
    final int included = data.limit() - data.position();
    final int length = included + PcapPacketRecord.HEADER_LENGTH;
    final ByteBuffer buffer = ByteBuffer.allocate(length);
    buffer.order(this.editor.order());

    PcapPacketRecordImpl.initBuffer(buffer, included, (int) original, seconds,
        (int) nanos / 1000);

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