Examples of Encoder


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

    Configuration conf = new Configuration(false);
    conf.setBoolean(CompressionContext.ENABLE_WAL_TAGS_COMPRESSION, compressTags);
    WALCellCodec codec = new WALCellCodec(conf, new CompressionContext(LRUDictionary.class, false,
        compressTags));
    ByteArrayOutputStream bos = new ByteArrayOutputStream(1024);
    Encoder encoder = codec.getEncoder(bos);
    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();
View Full Code Here

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

      }
    }
  }

  public void write(DataOutput out) throws IOException {
    Encoder kvEncoder = codec.getEncoder((DataOutputStream) out);
    out.writeInt(VERSION_2);

    //write out the keyvalues
    out.writeInt(kvs.size());
    for(KeyValue kv: kvs){
      kvEncoder.write(kv);
    }
    kvEncoder.flush();

    out.writeInt(scopes.size());
    for (byte[] key : scopes.keySet()) {
      Bytes.writeByteArray(out, key);
      out.writeInt(scopes.get(key));
View Full Code Here

Examples of org.apache.lucene.search.highlight.Encoder

    FragListBuilder fragListBuilder = new SimpleFragListBuilder();
    FragmentsBuilder fragmentsBuilder = new ScoreOrderFragmentsBuilder();
    IndexReader reader = DirectoryReader.open( writer, true );
    String[] preTags = new String[] { "<b>" };
    String[] postTags = new String[] { "</b>" };
    Encoder encoder = new DefaultEncoder();
    int docId = 0;
    BooleanQuery query = new BooleanQuery();
    for ( Query clause : queryClauses ) {
      query.add( clause, Occur.MUST );
    }
View Full Code Here

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

                        {
                            getParameters.put(pair.getKey(), pair.getValue());
                        }
                    }
                }
                Encoder enc = broker.createEncoder('G', seq);
                enc.writeMap(getParameters);
                String routingKey = agent.routingCode();
                Message msg = broker.createMessage(enc);
                log.debug("Get Object Keys: ");
                for (String pKey : getParameters.keySet())
                {
View Full Code Here

Examples of org.apache.ws.commons.util.Base64.Encoder

    pHandler.startElement("", VALUE_TAG, VALUE_TAG, ZERO_ATTRIBUTES);
    pHandler.startElement("", BASE_64_TAG, BASE_64_TAG, ZERO_ATTRIBUTES);
    byte[] buffer = (byte[]) pObject;
    if (buffer.length > 0) {
      char[] charBuffer = new char[buffer.length >= 1024 ? 1024 : ((buffer.length+3)/4)*4];
      Encoder encoder = new Base64.SAXEncoder(charBuffer, 0, null, pHandler);
      try {
        encoder.write(buffer, 0, buffer.length);
        encoder.flush();
      } catch (Base64.SAXIOException e) {
        throw e.getSAXException();
      } catch (IOException e) {
        throw new SAXException(e);
      }
View Full Code Here

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

         
          SocketAddress addr = message.getAddress();
          SocketAddress endpoint = NetworkUtils.getResolved(addr);
         
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          Encoder encoder = codec.createEncoder(baos);
          encoder.write(message);
          encoder.close();
         
          byte[] encoded = baos.toByteArray();
          DatagramPacket packet = new DatagramPacket(
              encoded, 0, encoded.length, endpoint);
         
View Full Code Here

Examples of org.asteriskjava.iax.audio.encodings.gsm.Encoder

    AudioGSM(Audio8k a8) {
        _a8 = a8;
        _obuff = new byte[320];
        _ibuff = new byte[a8.getSampSz()];
        encoder = new Encoder();
    }
View Full Code Here

Examples of org.geotools.xml.Encoder

        //create a new feautre collcetion type with just the numbers
        FeatureCollectionType hits = WfsFactory.eINSTANCE.createFeatureCollectionType();
        hits.setNumberOfFeatures(featureCollection.getNumberOfFeatures());
        hits.setTimeStamp(featureCollection.getTimeStamp());

        Encoder encoder = new Encoder(configuration, configuration.schema());
        encoder.setEncoding(Charset.forName( wfs.getGeoServer().getGlobal().getCharset()) );
        encoder.setSchemaLocation(org.geoserver.wfs.xml.v1_1_0.WFS.NAMESPACE,
            ResponseUtils.appendPath(wfs.getSchemaBaseURL(), "wfs/1.1.0/wfs.xsd"));

        encoder.encode(hits, org.geoserver.wfs.xml.v1_1_0.WFS.FEATURECOLLECTION, output);
    }
View Full Code Here

Examples of org.glassfish.grizzly.compression.lzma.impl.Encoder

    // --------------------------------------------------------- Private Methods


    private void initializeOutput(final LZMAOutputState state) {
        final Encoder encoder = state.getEncoder();
        encoder.setAlgorithm(lzmaProperties.getAlgorithm());
        encoder.setDictionarySize(lzmaProperties.getDictionarySize());
        encoder.setNumFastBytes(lzmaProperties.getNumFastBytes());
        encoder.setMatchFinder(lzmaProperties.getMatchFinder());
        encoder.setLcLpPb(lzmaProperties.getLc(), lzmaProperties.getLp(), lzmaProperties.getPb());
        encoder.setEndMarkerMode(true);
        state.setInitialized(true);
    }
View Full Code Here

Examples of org.gradle.example.codec.Encoder

  private List<String> getPoemLines(String poetName) {
    ContentFactory contentFactory = ContentFactory.getInstance();
    Content provider = contentFactory.getContentProvider(poetName);
    List<String> clearTextLines = provider.getLines();
    Encoder encoder = new Encoder();

    List<String> encodedLines = new ArrayList<String>();
    for(String line: clearTextLines) {
      encodedLines.add(encoder.encode(line));
    }
    return encodedLines;
  }
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.