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); } } }
public IntBuffer put(int[] src) { for (int i = 0; i < src.Length; ++i) { bytebuffer.putInt(src[i]); } return(this); }
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); }
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); }
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); }
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); } } }