putString() 공개 메소드

public putString ( string src ) : ByteBuffer
src string
리턴 ByteBuffer
예제 #1
0
파일: Header.cs 프로젝트: fbedada991/BCI
 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);
         }
     }
 }
예제 #2
0
        public void serialize(ByteBuffer buf)
        {
            switch (type)
            {
            case DataType.CHAR:
                buf.putString(array.ToString());
                break;

            case DataType.UINT8:
            case DataType.INT8:
                buf.put((byte[])array);
                break;

            case DataType.UINT16:
            case DataType.INT16:
                buf.asShortBuffer().put((short[])array);
                break;

            case DataType.UINT32:
            case DataType.INT32:
                buf.asIntBuffer().put((int[])array);
                break;

            case DataType.UINT64:
            case DataType.INT64:
                buf.asLongBuffer().put((long[])array);
                break;

            case DataType.FLOAT32:
                buf.asFloatBuffer().put((float[])array);
                break;

            case DataType.FLOAT64:
                buf.asDoubleBuffer().put((double[])array);
                break;
            }
        }
예제 #3
0
 public void serialize(ByteBuffer buf)
 {
     switch(type) {
         case DataType.CHAR:
             buf.putString(array.ToString());
             break;
         case DataType.UINT8:
         case DataType.INT8:
             buf.put((byte[]) array);
             break;
         case DataType.UINT16:
         case DataType.INT16:
             buf.asShortBuffer().put((short[]) array);
             break;
         case DataType.UINT32:
         case DataType.INT32:
             buf.asIntBuffer().put((int[]) array);
             break;
         case DataType.UINT64:
         case DataType.INT64:
             buf.asLongBuffer().put((long[]) array);
             break;
         case DataType.FLOAT32:
             buf.asFloatBuffer().put((float[]) array);
             break;
         case DataType.FLOAT64:
             buf.asDoubleBuffer().put((double[]) array);
             break;
     }
 }
예제 #4
0
파일: Header.cs 프로젝트: Wieke/buffer_bci
 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);
         }
     }
 }