Examples of encode()


Examples of info.archinnov.achilles.internal.metadata.codec.MapCodec.encode()

        Field field = Test.class.getDeclaredField("maps");

        //When
        final MapCodec codec = factory.parseMapField(createContext(field));
        Map<Object, Object> encoded = codec.encode(ImmutableMap.<Object, Object>of(PropertyType.COUNTER, ElementType.FIELD, PropertyType.ID, ElementType.METHOD));
        Map<Object, Object> decoded = codec.decode(ImmutableMap.<Object, Object>of("LIST", "CONSTRUCTOR", "SET", "PARAMETER"));

        //Then
        assertThat(encoded.get("COUNTER")).isEqualTo("FIELD");
        assertThat(encoded.get("ID")).isEqualTo("METHOD");

Examples of info.archinnov.achilles.internal.metadata.codec.SetCodec.encode()

        Field field = Test.class.getDeclaredField("types");

        //When
        final SetCodec codec = factory.parseSetField(createContext(field));
        final Set<Object> encoded = codec.encode(Sets.newSet(PropertyType.ID, PropertyType.EMBEDDED_ID));
        final Set<Object> decoded = codec.decode(Sets.newSet(2, 3, 4));

        //Then
        assertThat(encoded).containsOnly(0, 1);
        assertThat(decoded).containsOnly(PropertyType.SIMPLE, PropertyType.LIST, PropertyType.SET);

Examples of io.netty.handler.codec.http.CookieEncoder.encode()

                // Reset the cookies if necessary.
                CookieEncoder cookieEncoder = new CookieEncoder(true);
                for (Cookie cookie : cookies) {
                    cookieEncoder.addCookie(cookie);
                }
                response.addHeader(SET_COOKIE, cookieEncoder.encode());
            }
        }

        // Write the response.
        ChannelFuture future = e.getChannel().write(response);

Examples of io.vertx.core.json.JsonArray.encode()

        "  This is a another multi \n" +
        "  line comment this time inside the JSON array itself\n" +
        "*/\n" +
        "]";
    JsonArray json = new JsonArray(jsonWithComments);
    assertEquals("[\"foo\",\"bar\"]", json.encode());
  }

  @Test
  public void testInvalidJson() {
    String invalid = "qiwjdoiqwjdiqwjd";

Examples of io.vertx.core.json.JsonObject.encode()

    byte[] bytes = TestUtils.randomByteArray(10);
    String strBytes = Base64.getEncoder().encodeToString(bytes);
    String json = "{\"mystr\":\"foo\",\"myint\":123,\"mylong\":1234,\"myfloat\":1.23,\"mydouble\":2.34,\"" +
      "myboolean\":true,\"mybinary\":\"" + strBytes + "\",\"mynull\":null,\"myobj\":{\"foo\":\"bar\"},\"myarr\":[\"foo\",123]}";
    JsonObject obj = new JsonObject(json);
    assertEquals(json, obj.encode());
    assertEquals("foo", obj.getString("mystr"));
    assertEquals(Integer.valueOf(123), obj.getInteger("myint"));
    assertEquals(Long.valueOf(1234), obj.getLong("mylong"));
    assertEquals(Float.valueOf(1.23f), obj.getFloat("myfloat"));
    assertEquals(Double.valueOf(2.34d), obj.getDouble("mydouble"));

Examples of it.eng.spagobi.commons.utilities.ParameterValuesEncoder.encode()

    if (biobj.getBiObjectParameters() != null) {
        BIObjectParameter biobjPar = null;
        for (Iterator it = biobj.getBiObjectParameters().iterator(); it.hasNext();) {
        try {
            biobjPar = (BIObjectParameter) it.next();
            String value = parValuesEncoder.encode(biobjPar);
            if (value != null)
          pars.put(biobjPar.getParameterUrlName(), value);
            else
          logger.warn("value encoded IS null");
            logger.debug("Add parameter:" + biobjPar.getParameterUrlName() + "/" + value);

Examples of it.eng.spagobi.utilities.service.IStreamEncoder.encode()

                   
          File dir = new File(dirS);
          imageFile = File.createTempFile("tempJPEGExport", ".jpeg" , dir);
          FileOutputStream stream = new FileOutputStream(imageFile);
         
          encoder.encode(bis,stream);
         
          stream.flush();
          stream.close();   
         
          File dirF = new File(dirS);

Examples of it.sauronsoftware.jave.Encoder.encode()

    EncodingAttributes attrs = new EncodingAttributes();
    attrs.setFormat("mp3");
    attrs.setAudioAttributes(audio);
   
    Encoder encoder = new Encoder(new Myffmpeg());
    encoder.encode(source, target, attrs);
  }
 
  static void copyFileToOgg(File source) throws IllegalArgumentException, InputFormatException, EncoderException{
    File target = new File(getDirByExtension("ogg"), changeExtension(getRelativePath(source), ".ogg"));
    if (target.exists()) return;

Examples of jade.lang.acl.ACLCodec.encode()

        String charset; 
        if ((env == null) ||
            ((charset = env.getPayloadEncoding()) == null)) {
          charset = ACLCodec.DEFAULT_CHARSET;
        }
        return codec.encode(msg,charset);
      }
      else {
        // Unsupported Codec
        //FIXME: find the best according to the supported, the MTP (and the receivers Codec)
        throw new MessagingService.UnknownACLEncodingException("Unknown ACL encoding: " + enc + ".");

Examples of java.nio.charset.Charset.encode()

  }

  // convert char array to byte array, assuming UTF-8 encoding
  static protected byte[] convertCharToByteUTF(char[] from) {
    Charset c = Charset.forName("UTF-8");
    ByteBuffer output = c.encode(CharBuffer.wrap(from));
    return output.array();
  }

  //////////////////////////////////////////////////////////////////////////////////////
  // create new file
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.