Package net.sf.cram

Examples of net.sf.cram.EncodingID


        String key = new String(new byte[] { buf.get(), buf.get() });
        EncodingKey eKey = EncodingKey.byFirstTwoChars(key);
        if (eKey == null)
          throw new RuntimeException("Unknown encoding key: " + key);

        EncodingID id = EncodingID.values()[buf.get()];
        int paramLen = ByteBufferUtils.readUnsignedITF8(buf);
        byte[] paramBytes = new byte[paramLen];
        buf.get(paramBytes);

        eMap.put(eKey, new EncodingParams(id, paramBytes));

        log.debug(String.format("FOUND ENCODING: %s, %s, %s.",
            eKey.name(), id.name(),
            Arrays.toString(Arrays.copyOf(paramBytes, 20))));
      }
    }

    { // tag encoding map:
      int byteSize = ByteBufferUtils.readUnsignedITF8(is);
      byte[] bytes = new byte[byteSize];
      ByteBufferUtils.readFully(bytes, is);
      ByteBuffer buf = ByteBuffer.wrap(bytes);

      int mapSize = ByteBufferUtils.readUnsignedITF8(buf);
      tMap = new TreeMap<Integer, EncodingParams>();
      for (int i = 0; i < mapSize; i++) {
        int key = ByteBufferUtils.readUnsignedITF8(buf);

        EncodingID id = EncodingID.values()[buf.get()];
        int paramLen = ByteBufferUtils.readUnsignedITF8(buf);
        byte[] paramBytes = new byte[paramLen];
        buf.get(paramBytes);

        tMap.put(key, new EncodingParams(id, paramBytes));
View Full Code Here


  public void fromByteArray(byte[] data) {
    ByteBuffer buf = ByteBuffer.wrap(data);

    EncodingFactory f = new EncodingFactory();

    EncodingID lenID = EncodingID.values()[buf.get()];
    lenEncoding = f.createEncoding(DataSeriesType.INT, lenID);
    int len = ByteBufferUtils.readUnsignedITF8(buf);
    byte[] bytes = new byte[len];
    buf.get(bytes);
    lenEncoding.fromByteArray(bytes);

    EncodingID byteID = EncodingID.values()[buf.get()];
    byteEncoding = f.createEncoding(DataSeriesType.BYTE_ARRAY, byteID);
    len = ByteBufferUtils.readUnsignedITF8(buf);
    bytes = new byte[len];
    buf.get(bytes);
    byteEncoding.fromByteArray(bytes);
View Full Code Here

TOP

Related Classes of net.sf.cram.EncodingID

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.