putInt() public method

public putInt ( int src ) : ByteBuffer
src int
return ByteBuffer
Esempio n. 1
0
 public void serialize(ByteBuffer buf)
 {
     buf.putInt(nChans);
     buf.putInt(nSamples);
     buf.putInt(nEvents);
     buf.putFloat(fSample);
     buf.putInt(dataType);
     if (channelNameSize <= nChans)
     {
         // channel names are all empty or array length does not match
         buf.putInt(0);
     }
     else
     {
         buf.putInt(8 + channelNameSize);                        // 8 bytes for chunk def
         buf.putInt(CHUNK_CHANNEL_NAMES);
         buf.putInt(channelNameSize);
         for (int i = 0; i < nChans; i++)
         {
             if (labels[i] != null)
             {
                 buf.putString(labels[i]);
             }
             buf.putByte((byte)0);
         }
     }
 }
Esempio n. 2
0
 public IntBuffer put(int[] src)
 {
     for (int i = 0; i < src.Length; ++i)
     {
         bytebuffer.putInt(src[i]);
     }
     return(this);
 }
Esempio n. 3
0
 public void serialize(ByteBuffer buf)
 {
     buf.putInt(wType.type);
     buf.putInt(wType.numel);
     buf.putInt(wValue.type);
     buf.putInt(wValue.numel);
     buf.putInt(sample);
     buf.putInt(offset);
     buf.putInt(duration);
     buf.putInt(wType.size + wValue.size);
     wType.serialize(buf);
     wValue.serialize(buf);
 }
Esempio n. 4
0
        protected ByteBuffer preparePutData(int nChans, int nSamples, int type)
        {
            int bufsize = DataType.wordSize[type] * nSamples * nChans;

            ByteBuffer buf = ByteBuffer.allocate(8 + 16 + bufsize);

            buf.order(myOrder);
            buf.putShort(VERSION).putShort(PUT_DAT).putInt(16 + bufsize);
            buf.putInt(nChans).putInt(nSamples).putInt(type).putInt(bufsize);
            return(buf);
        }
Esempio n. 5
0
 public void serialize(ByteBuffer buf)
 {
     buf.putInt(wType.type);
     buf.putInt(wType.numel);
     buf.putInt(wValue.type);
     buf.putInt(wValue.numel);
     buf.putInt(sample);
     buf.putInt(offset);
     buf.putInt(duration);
     buf.putInt(wType.size+wValue.size);
     wType.serialize(buf);
     wValue.serialize(buf);
 }
Esempio n. 6
0
 public void serialize(ByteBuffer buf)
 {
     buf.putInt(nChans);
     buf.putInt(nSamples);
     buf.putInt(nEvents);
     buf.putFloat(fSample);
     buf.putInt(dataType);
     if (channelNameSize <= nChans) {
         // channel names are all empty or array length does not match
         buf.putInt(0);
     } else {
         buf.putInt(8 + channelNameSize);	// 8 bytes for chunk def
         buf.putInt(CHUNK_CHANNEL_NAMES);
         buf.putInt(channelNameSize);
         for (int i=0;i<nChans;i++) {
             if (labels[i] != null)
                 buf.putString( labels[i]);
             buf.putByte((byte) 0);
         }
     }
 }