Java 类org.codehaus.jackson.Base64Variants 实例源码

项目:12306-android-Decompile    文件:StdDeserializer.java   
public String deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  JsonToken localJsonToken = paramJsonParser.getCurrentToken();
  if (localJsonToken == JsonToken.VALUE_STRING)
    return paramJsonParser.getText();
  if (localJsonToken == JsonToken.VALUE_EMBEDDED_OBJECT)
  {
    Object localObject = paramJsonParser.getEmbeddedObject();
    if (localObject == null)
      return null;
    if ((localObject instanceof byte[]))
      return Base64Variants.getDefaultVariant().encode((byte[])(byte[])localObject, false);
    return localObject.toString();
  }
  if (localJsonToken.isScalarValue())
    return paramJsonParser.getText();
  throw paramDeserializationContext.mappingException(this._valueClass);
}
项目:12306-android-Decompile    文件:StdDeserializer.java   
public String deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  JsonToken localJsonToken = paramJsonParser.getCurrentToken();
  if (localJsonToken == JsonToken.VALUE_STRING)
    return paramJsonParser.getText();
  if (localJsonToken == JsonToken.VALUE_EMBEDDED_OBJECT)
  {
    Object localObject = paramJsonParser.getEmbeddedObject();
    if (localObject == null)
      return null;
    if ((localObject instanceof byte[]))
      return Base64Variants.getDefaultVariant().encode((byte[])(byte[])localObject, false);
    return localObject.toString();
  }
  if (localJsonToken.isScalarValue())
    return paramJsonParser.getText();
  throw paramDeserializationContext.mappingException(this._valueClass);
}
项目:ingress-indonesia-dev    文件:StringDeserializer.java   
public String deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
{
  JsonToken localJsonToken = paramJsonParser.getCurrentToken();
  if (localJsonToken == JsonToken.VALUE_STRING)
    return paramJsonParser.getText();
  if (localJsonToken == JsonToken.VALUE_EMBEDDED_OBJECT)
  {
    Object localObject = paramJsonParser.getEmbeddedObject();
    if (localObject == null)
      return null;
    if ((localObject instanceof byte[]))
      return Base64Variants.getDefaultVariant().encode((byte[])localObject, false);
    return localObject.toString();
  }
  if (localJsonToken.isScalarValue())
    return paramJsonParser.getText();
  throw paramDeserializationContext.mappingException(this._valueClass, localJsonToken);
}
项目:es-hadoop-v2.2.0    文件:AbstractValueReaderTest.java   
@Test
public void testByteArray() {
    String encode = Base64Variants.getDefaultVariant().encode("byte array".getBytes());
    checkByteArray(typeFromJson("\"" + encode + "\""), encode);
}
项目:12306-android-Decompile    文件:ArrayDeserializers.java   
public char[] deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  JsonToken localJsonToken1 = paramJsonParser.getCurrentToken();
  if (localJsonToken1 == JsonToken.VALUE_STRING)
  {
    char[] arrayOfChar1 = paramJsonParser.getTextCharacters();
    int i = paramJsonParser.getTextOffset();
    int j = paramJsonParser.getTextLength();
    char[] arrayOfChar2 = new char[j];
    System.arraycopy(arrayOfChar1, i, arrayOfChar2, 0, j);
    return arrayOfChar2;
  }
  if (paramJsonParser.isExpectedStartArrayToken())
  {
    StringBuilder localStringBuilder = new StringBuilder(64);
    while (true)
    {
      JsonToken localJsonToken2 = paramJsonParser.nextToken();
      if (localJsonToken2 == JsonToken.END_ARRAY)
        break;
      if (localJsonToken2 != JsonToken.VALUE_STRING)
        throw paramDeserializationContext.mappingException(Character.TYPE);
      String str = paramJsonParser.getText();
      if (str.length() != 1)
        throw JsonMappingException.from(paramJsonParser, "Can not convert a JSON String of length " + str.length() + " into a char element of char array");
      localStringBuilder.append(str.charAt(0));
    }
    return localStringBuilder.toString().toCharArray();
  }
  if (localJsonToken1 == JsonToken.VALUE_EMBEDDED_OBJECT)
  {
    Object localObject = paramJsonParser.getEmbeddedObject();
    if (localObject == null)
      return null;
    if ((localObject instanceof char[]))
      return (char[])(char[])localObject;
    if ((localObject instanceof String))
      return ((String)localObject).toCharArray();
    if ((localObject instanceof byte[]))
      return Base64Variants.getDefaultVariant().encode((byte[])(byte[])localObject, false).toCharArray();
  }
  throw paramDeserializationContext.mappingException(this._valueClass);
}
项目:12306-android-Decompile    文件:DeserializationConfig.java   
public Base64Variant getBase64Variant()
{
  return Base64Variants.getDefaultVariant();
}
项目:12306-android-Decompile    文件:BinaryNode.java   
public String getValueAsText()
{
  return Base64Variants.getDefaultVariant().encode(this._data, false);
}
项目:12306-android-Decompile    文件:BinaryNode.java   
public String toString()
{
  return Base64Variants.getDefaultVariant().encode(this._data, true);
}
项目:12306-android-Decompile    文件:TextNode.java   
public byte[] getBinaryValue()
  throws IOException
{
  return getBinaryValue(Base64Variants.getDefaultVariant());
}
项目:elasticsearch-hadoop    文件:AbstractValueReaderTest.java   
@Test
public void testByteArray() {
    String encode = Base64Variants.getDefaultVariant().encode("byte array".getBytes());
    checkByteArray(typeFromJson("\"" + encode + "\""), encode);
}
项目:elasticsearch-hadoop    文件:AbstractValueReaderTest.java   
@Test
public void testBinary() {
    String encode = Base64Variants.getDefaultVariant().encode("binary blob".getBytes());
    checkBinary(readFromJson("\"" + encode + "\"", FieldType.BINARY), encode.getBytes());
}
项目:12306-android-Decompile    文件:ArrayDeserializers.java   
public char[] deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  JsonToken localJsonToken1 = paramJsonParser.getCurrentToken();
  if (localJsonToken1 == JsonToken.VALUE_STRING)
  {
    char[] arrayOfChar1 = paramJsonParser.getTextCharacters();
    int i = paramJsonParser.getTextOffset();
    int j = paramJsonParser.getTextLength();
    char[] arrayOfChar2 = new char[j];
    System.arraycopy(arrayOfChar1, i, arrayOfChar2, 0, j);
    return arrayOfChar2;
  }
  if (paramJsonParser.isExpectedStartArrayToken())
  {
    StringBuilder localStringBuilder = new StringBuilder(64);
    while (true)
    {
      JsonToken localJsonToken2 = paramJsonParser.nextToken();
      if (localJsonToken2 == JsonToken.END_ARRAY)
        break;
      if (localJsonToken2 != JsonToken.VALUE_STRING)
        throw paramDeserializationContext.mappingException(Character.TYPE);
      String str = paramJsonParser.getText();
      if (str.length() != 1)
        throw JsonMappingException.from(paramJsonParser, "Can not convert a JSON String of length " + str.length() + " into a char element of char array");
      localStringBuilder.append(str.charAt(0));
    }
    return localStringBuilder.toString().toCharArray();
  }
  if (localJsonToken1 == JsonToken.VALUE_EMBEDDED_OBJECT)
  {
    Object localObject = paramJsonParser.getEmbeddedObject();
    if (localObject == null)
      return null;
    if ((localObject instanceof char[]))
      return (char[])(char[])localObject;
    if ((localObject instanceof String))
      return ((String)localObject).toCharArray();
    if ((localObject instanceof byte[]))
      return Base64Variants.getDefaultVariant().encode((byte[])(byte[])localObject, false).toCharArray();
  }
  throw paramDeserializationContext.mappingException(this._valueClass);
}
项目:12306-android-Decompile    文件:DeserializationConfig.java   
public Base64Variant getBase64Variant()
{
  return Base64Variants.getDefaultVariant();
}
项目:12306-android-Decompile    文件:BinaryNode.java   
public String getValueAsText()
{
  return Base64Variants.getDefaultVariant().encode(this._data, false);
}
项目:12306-android-Decompile    文件:BinaryNode.java   
public String toString()
{
  return Base64Variants.getDefaultVariant().encode(this._data, true);
}
项目:12306-android-Decompile    文件:TextNode.java   
public byte[] getBinaryValue()
  throws IOException
{
  return getBinaryValue(Base64Variants.getDefaultVariant());
}
项目:ingress-indonesia-dev    文件:PrimitiveArrayDeserializers$CharDeser.java   
public final char[] deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
{
  JsonToken localJsonToken1 = paramJsonParser.getCurrentToken();
  if (localJsonToken1 == JsonToken.VALUE_STRING)
  {
    char[] arrayOfChar1 = paramJsonParser.getTextCharacters();
    int i = paramJsonParser.getTextOffset();
    int j = paramJsonParser.getTextLength();
    char[] arrayOfChar2 = new char[j];
    System.arraycopy(arrayOfChar1, i, arrayOfChar2, 0, j);
    return arrayOfChar2;
  }
  if (paramJsonParser.isExpectedStartArrayToken())
  {
    StringBuilder localStringBuilder = new StringBuilder(64);
    while (true)
    {
      JsonToken localJsonToken2 = paramJsonParser.nextToken();
      if (localJsonToken2 == JsonToken.END_ARRAY)
        break;
      if (localJsonToken2 != JsonToken.VALUE_STRING)
        throw paramDeserializationContext.mappingException(Character.TYPE);
      String str = paramJsonParser.getText();
      if (str.length() != 1)
        throw JsonMappingException.from(paramJsonParser, "Can not convert a JSON String of length " + str.length() + " into a char element of char array");
      localStringBuilder.append(str.charAt(0));
    }
    return localStringBuilder.toString().toCharArray();
  }
  if (localJsonToken1 == JsonToken.VALUE_EMBEDDED_OBJECT)
  {
    Object localObject = paramJsonParser.getEmbeddedObject();
    if (localObject == null)
      return null;
    if ((localObject instanceof char[]))
      return (char[])localObject;
    if ((localObject instanceof String))
      return ((String)localObject).toCharArray();
    if ((localObject instanceof byte[]))
      return Base64Variants.getDefaultVariant().encode((byte[])localObject, false).toCharArray();
  }
  throw paramDeserializationContext.mappingException(this._valueClass);
}
项目:ingress-indonesia-dev    文件:DeserializationConfig.java   
public Base64Variant getBase64Variant()
{
  return Base64Variants.getDefaultVariant();
}
项目:RHome    文件:DeserializationConfig.java   
/**
 * Method called during deserialization if Base64 encoded content
 * needs to be decoded. Default version just returns default Jackson
 * uses, which is modified-mime which does not add linefeeds (because
 * those would have to be escaped in Json strings).
 */
public Base64Variant getBase64Variant() {
    return Base64Variants.getDefaultVariant();
}