Package de.fhg.igd.mongomvcc.helper

Examples of de.fhg.igd.mongomvcc.helper.FloatArrayInputStream


    GridFSInputFile file;
    if (data instanceof byte[]) {
      file = _gridFS.createFile((byte[])data);
      file.put(BINARY_TYPE, BYTEARRAY);
    } else if (data instanceof float[]) {
      file = _gridFS.createFile(new FloatArrayInputStream((float[])data));
      file.put(BINARY_TYPE, FLOATARRAY);
    } else if (data instanceof InputStream) {
      file = _gridFS.createFile((InputStream)data);
      file.put(BINARY_TYPE, INPUTSTREAM);
    } else if (data instanceof ByteBuffer) {
      ByteBuffer bb = (ByteBuffer)data;
      byte[] buf;
      if (bb.hasArray()) {
        buf = bb.array();
      } else {
        bb.rewind();
        buf = new byte[bb.remaining()];
        bb.get(buf);
      }
      file = _gridFS.createFile(buf);
      file.put(BINARY_TYPE, BYTEBUFFER);
    } else if (data instanceof FloatBuffer) {
      FloatBuffer bb = (FloatBuffer)data;
      float[] buf;
      if (bb.hasArray()) {
        buf = bb.array();
      } else {
        bb.rewind();
        buf = new float[bb.remaining()];
        bb.get(buf);
      }
      file = _gridFS.createFile(new FloatArrayInputStream(buf));
      file.put(BINARY_TYPE, FLOATBUFFER);
    } else {
      return 0;
    }
View Full Code Here

TOP

Related Classes of de.fhg.igd.mongomvcc.helper.FloatArrayInputStream

Copyright © 2018 www.massapicom. 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.