Examples of Decoder


Examples of org.apache.hadoop.hbase.codec.Codec.Decoder

    encoder.write(createKV(1));
    encoder.write(createKV(0));
    encoder.write(createKV(2));

    InputStream is = new ByteArrayInputStream(bos.toByteArray());
    Decoder decoder = codec.getDecoder(is);
    decoder.advance();
    KeyValue kv = (KeyValue) decoder.current();
    List<Tag> tags = kv.getTags();
    assertEquals(1, tags.size());
    assertEquals("tagValue1", Bytes.toString(tags.get(0).getValue()));
    decoder.advance();
    kv = (KeyValue) decoder.current();
    tags = kv.getTags();
    assertEquals(0, tags.size());
    decoder.advance();
    kv = (KeyValue) decoder.current();
    tags = kv.getTags();
    assertEquals(2, tags.size());
    assertEquals("tagValue1", Bytes.toString(tags.get(0).getValue()));
    assertEquals("tagValue2", Bytes.toString(tags.get(1).getValue()));
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.codec.Decoder

  }

  public void readFields(DataInput in) throws IOException {
    kvs.clear();
    scopes.clear();
    Decoder decoder = this.codec.getDecoder((DataInputStream) in);
    int versionOrLength = in.readInt();
    int length = versionOrLength;

    // make sure we get the real length
    if (versionOrLength == VERSION_2) {
      length = in.readInt();
    }

    // read in all the key values
    kvs.ensureCapacity(length);
    for(int i=0; i< length && decoder.advance(); i++) {
      kvs.add(decoder.current());
    }

    //its a new style WAL, so we need replication scopes too
    if (versionOrLength == VERSION_2) {
      int numEntries = in.readInt();
View Full Code Here

Examples of org.apache.hadoop.raid.Decoder

    if (reporter == null) {
      reporter = RaidUtils.NULL_PROGRESSABLE;
    }
   
    // try to decode.
    Decoder decoder = new Decoder(conf, codec);
    if (codec.isDirRaid) {
      decoder.connectToStore(srcPath);
    }
   
    List<Long> errorOffsets = new ArrayList<Long>();
    // first limit bytes
    errorOffsets.add(blockOffset);
View Full Code Here

Examples of org.apache.log4j.spi.Decoder

                public void run() {
                    logger.debug("Loading files: " + fileList);
                    for (Iterator iter = fileList.iterator(); iter.hasNext();) {
                        File  file = (File) iter.next();
                        final Decoder decoder = new XMLDecoder();
                        try {
                            getStatusBar().setMessage("Loading " + file.getAbsolutePath() + "...");
                            FileLoadAction.importURL(handler, decoder, file
                                    .getName(), file.toURL());
                        } catch (Exception e) {
View Full Code Here

Examples of org.apache.qpid.transport.codec.Decoder

        return connected;
    }

    public void onMessage(Message msg)
    {
        Decoder decoder = readBody(msg);
        HeaderInfo headerInfo = this.CheckHeader(decoder);
        // log.debug(headerInfo.toString());
        while (headerInfo.valid)
        {
            long seq = headerInfo.sequence;
View Full Code Here

Examples of org.apache.sis.internal.netcdf.Decoder

     * @throws DataStoreException Should never happen.
     */
    @Test
    public void testDecoderFromStream() throws IOException, DataStoreException {
        final StorageConnector c = new StorageConnector(IOTestCase.getResourceAsStream(NCEP));
        final Decoder decoder = NetcdfStoreProvider.decoder(TestCase.LISTENERS, c);
        assertInstanceOf(NCEP, ChannelDecoder.class, decoder);
        decoder.close();
    }
View Full Code Here

Examples of org.ardverk.dht.codec.MessageCodec.Decoder

    final byte[] data = extract(packet);
   
    Runnable task = new Runnable() {
      @Override
      public void run() {
        Decoder decoder = null;
        try {
          decoder = codec.createDecoder(src,
              new ByteArrayInputStream(data));
          Message message = decoder.read();
         
          if (message instanceof RequestMessage) {
            handleRequest((RequestMessage)message);
          } else {
            handleResponse((ResponseMessage)message);
View Full Code Here

Examples of org.getopt.luke.decoders.Decoder

      bw.write("' flags='" + Util.fieldFlags((Field)fields[0], infos.fieldInfo(fields[0].name())) + "'>\n");
      for (IndexableField ixf : fields) {
        String val = null;
        Field f = (Field)ixf;
        if (decode) {
          Decoder d = decoders.get(f.name());
          if (d != null) {
            val = d.decodeStored(f.name(), f);
          }
        }
        if (!decode || val == null) {
          if (f.binaryValue() != null) {
            val = Util.bytesToHex(f.binaryValue(), false);
View Full Code Here

Examples of org.getopt.luke.decoders.Decoder

    if (topTerms != null) {
      bw.write(" <topTerms count='" + topTerms.length + "'>\n");
      for (TermStats ts : topTerms) {
        String val = null;
        if (decode) {
          Decoder d = decoders.get(ts.field);
          if (d != null) {
            val = d.decodeTerm(ts.field, ts.termtext);
          }
        }
        if (!decode || val == null) {
          val = ts.termtext.utf8ToString();
        }
View Full Code Here

Examples of org.getopt.luke.decoders.Decoder

        cell = create("cell");
        add(row, cell);
      }
      cell = create("cell");
      setChoice(cell, "alignment", "right");
      Decoder dec = decoders.get(s);
      if (dec == null) dec = defDecoder;
      setString(cell, "text", dec.toString());
      add(row, cell);
      // populate combos
      Object choice = create("choice");
      add(fCombo, choice);
      setString(choice, "text", s);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.