Java 类org.codehaus.jackson.map.util.ObjectBuffer 实例源码

项目:RHome    文件:ArrayDeserializers.java   
public String[] deserialize(JsonParser jp, DeserializationContext ctxt)
    throws IOException, JsonProcessingException
{
    // Ok: must point to START_ARRAY
    if (jp.getCurrentToken() != JsonToken.START_ARRAY) {
        throw ctxt.mappingException(_valueClass);
    }
    final ObjectBuffer buffer = ctxt.leaseObjectBuffer();
    Object[] chunk = buffer.resetAndStart();
    int ix = 0;
    JsonToken t;

    while ((t = jp.nextToken()) != JsonToken.END_ARRAY) {
        // Ok: no need to convert Strings, but must recognize nulls
        String value = (t == JsonToken.VALUE_NULL) ? null : jp.getText();
        if (ix >= chunk.length) {
            chunk = buffer.appendCompletedChunk(chunk);
            ix = 0;
        }
        chunk[ix++] = value;
    }
    String[] result = buffer.completeAndClearBuffer(chunk, ix, String.class);
    ctxt.returnObjectBuffer(buffer);
    return result;
}
项目:ingress-indonesia-dev    文件:UntypedObjectDeserializer.java   
protected Object mapArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
{
  if (paramDeserializationContext.isEnabled(DeserializationConfig.Feature.USE_JAVA_ARRAY_FOR_JSON_ARRAY))
    return mapArrayToArray(paramJsonParser, paramDeserializationContext);
  if (paramJsonParser.nextToken() == JsonToken.END_ARRAY)
    return new ArrayList(4);
  ObjectBuffer localObjectBuffer = paramDeserializationContext.leaseObjectBuffer();
  Object[] arrayOfObject1 = localObjectBuffer.resetAndStart();
  int i = 0;
  Object[] arrayOfObject2 = arrayOfObject1;
  int j = 0;
  Object localObject = deserialize(paramJsonParser, paramDeserializationContext);
  j++;
  if (i >= arrayOfObject2.length)
    arrayOfObject2 = localObjectBuffer.appendCompletedChunk(arrayOfObject2);
  for (int k = 0; ; k = i)
  {
    i = k + 1;
    arrayOfObject2[k] = localObject;
    if (paramJsonParser.nextToken() != JsonToken.END_ARRAY)
      break;
    ArrayList localArrayList = new ArrayList(1 + (j + (j >> 3)));
    localObjectBuffer.completeAndClearBuffer(arrayOfObject2, i, localArrayList);
    return localArrayList;
  }
}
项目:ingress-indonesia-dev    文件:UntypedObjectDeserializer.java   
protected Object[] mapArrayToArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
{
  if (paramJsonParser.nextToken() == JsonToken.END_ARRAY)
    return NO_OBJECTS;
  ObjectBuffer localObjectBuffer = paramDeserializationContext.leaseObjectBuffer();
  Object[] arrayOfObject = localObjectBuffer.resetAndStart();
  int i = 0;
  Object localObject = deserialize(paramJsonParser, paramDeserializationContext);
  if (i >= arrayOfObject.length)
    arrayOfObject = localObjectBuffer.appendCompletedChunk(arrayOfObject);
  for (int j = 0; ; j = i)
  {
    i = j + 1;
    arrayOfObject[j] = localObject;
    if (paramJsonParser.nextToken() != JsonToken.END_ARRAY)
      break;
    return localObjectBuffer.completeAndClearBuffer(arrayOfObject, i);
  }
}
项目:12306-android-Decompile    文件:UntypedObjectDeserializer.java   
protected List<Object> mapArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  if (paramJsonParser.nextToken() == JsonToken.END_ARRAY)
    return new ArrayList(4);
  ObjectBuffer localObjectBuffer = paramDeserializationContext.leaseObjectBuffer();
  Object[] arrayOfObject = localObjectBuffer.resetAndStart();
  int i = 0;
  int j = 0;
  while (true)
  {
    Object localObject = deserialize(paramJsonParser, paramDeserializationContext);
    j++;
    if (i >= arrayOfObject.length)
    {
      arrayOfObject = localObjectBuffer.appendCompletedChunk(arrayOfObject);
      i = 0;
    }
    int k = i + 1;
    arrayOfObject[i] = localObject;
    if (paramJsonParser.nextToken() == JsonToken.END_ARRAY)
    {
      ArrayList localArrayList = new ArrayList(1 + (j + (j >> 3)));
      localObjectBuffer.completeAndClearBuffer(arrayOfObject, k, localArrayList);
      return localArrayList;
    }
    i = k;
  }
}
项目:12306-android-Decompile    文件:StdDeserializationContext.java   
public final ObjectBuffer leaseObjectBuffer()
{
  ObjectBuffer localObjectBuffer = this._objectBuffer;
  if (localObjectBuffer == null)
    return new ObjectBuffer();
  this._objectBuffer = null;
  return localObjectBuffer;
}
项目:12306-android-Decompile    文件:ArrayDeserializers.java   
public String[] deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  if (!paramJsonParser.isExpectedStartArrayToken())
    return handleNonArray(paramJsonParser, paramDeserializationContext);
  ObjectBuffer localObjectBuffer = paramDeserializationContext.leaseObjectBuffer();
  Object[] arrayOfObject = localObjectBuffer.resetAndStart();
  int i = 0;
  JsonToken localJsonToken = paramJsonParser.nextToken();
  if (localJsonToken != JsonToken.END_ARRAY)
  {
    if (localJsonToken == JsonToken.VALUE_NULL);
    for (String str = null; ; str = paramJsonParser.getText())
    {
      if (i >= arrayOfObject.length)
      {
        arrayOfObject = localObjectBuffer.appendCompletedChunk(arrayOfObject);
        i = 0;
      }
      int j = i + 1;
      arrayOfObject[i] = str;
      i = j;
      break;
    }
  }
  String[] arrayOfString = (String[])localObjectBuffer.completeAndClearBuffer(arrayOfObject, i, String.class);
  paramDeserializationContext.returnObjectBuffer(localObjectBuffer);
  return arrayOfString;
}
项目:RHome    文件:StdDeserializationContext.java   
@Override
public final void returnObjectBuffer(ObjectBuffer buf)
{
    /* Already have a reusable buffer? Let's retain bigger one
     * (or if equal, favor newer one, shorter life-cycle)
     */
    if (_objectBuffer == null
        || buf.initialCapacity() >= _objectBuffer.initialCapacity()) {
        _objectBuffer = buf;
    }
}
项目:12306-android-Decompile    文件:UntypedObjectDeserializer.java   
protected List<Object> mapArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  if (paramJsonParser.nextToken() == JsonToken.END_ARRAY)
    return new ArrayList(4);
  ObjectBuffer localObjectBuffer = paramDeserializationContext.leaseObjectBuffer();
  Object[] arrayOfObject = localObjectBuffer.resetAndStart();
  int i = 0;
  int j = 0;
  while (true)
  {
    Object localObject = deserialize(paramJsonParser, paramDeserializationContext);
    j++;
    if (i >= arrayOfObject.length)
    {
      arrayOfObject = localObjectBuffer.appendCompletedChunk(arrayOfObject);
      i = 0;
    }
    int k = i + 1;
    arrayOfObject[i] = localObject;
    if (paramJsonParser.nextToken() == JsonToken.END_ARRAY)
    {
      ArrayList localArrayList = new ArrayList(1 + (j + (j >> 3)));
      localObjectBuffer.completeAndClearBuffer(arrayOfObject, k, localArrayList);
      return localArrayList;
    }
    i = k;
  }
}
项目:12306-android-Decompile    文件:StdDeserializationContext.java   
public final ObjectBuffer leaseObjectBuffer()
{
  ObjectBuffer localObjectBuffer = this._objectBuffer;
  if (localObjectBuffer == null)
    return new ObjectBuffer();
  this._objectBuffer = null;
  return localObjectBuffer;
}
项目:12306-android-Decompile    文件:ArrayDeserializers.java   
public String[] deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  if (!paramJsonParser.isExpectedStartArrayToken())
    return handleNonArray(paramJsonParser, paramDeserializationContext);
  ObjectBuffer localObjectBuffer = paramDeserializationContext.leaseObjectBuffer();
  Object[] arrayOfObject = localObjectBuffer.resetAndStart();
  int i = 0;
  JsonToken localJsonToken = paramJsonParser.nextToken();
  if (localJsonToken != JsonToken.END_ARRAY)
  {
    if (localJsonToken == JsonToken.VALUE_NULL);
    for (String str = null; ; str = paramJsonParser.getText())
    {
      if (i >= arrayOfObject.length)
      {
        arrayOfObject = localObjectBuffer.appendCompletedChunk(arrayOfObject);
        i = 0;
      }
      int j = i + 1;
      arrayOfObject[i] = str;
      i = j;
      break;
    }
  }
  String[] arrayOfString = (String[])localObjectBuffer.completeAndClearBuffer(arrayOfObject, i, String.class);
  paramDeserializationContext.returnObjectBuffer(localObjectBuffer);
  return arrayOfString;
}
项目:ingress-indonesia-dev    文件:ObjectArrayDeserializer.java   
public Object[] deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
{
  if (!paramJsonParser.isExpectedStartArrayToken())
    return handleNonArray(paramJsonParser, paramDeserializationContext);
  ObjectBuffer localObjectBuffer = paramDeserializationContext.leaseObjectBuffer();
  Object[] arrayOfObject1 = localObjectBuffer.resetAndStart();
  TypeDeserializer localTypeDeserializer = this._elementTypeDeserializer;
  Object[] arrayOfObject2 = arrayOfObject1;
  int i = 0;
  JsonToken localJsonToken = paramJsonParser.nextToken();
  Object localObject;
  if (localJsonToken != JsonToken.END_ARRAY)
    if (localJsonToken == JsonToken.VALUE_NULL)
    {
      localObject = null;
      label63: if (i < arrayOfObject2.length)
        break label175;
      arrayOfObject2 = localObjectBuffer.appendCompletedChunk(arrayOfObject2);
    }
  label175: for (int j = 0; ; j = i)
  {
    i = j + 1;
    arrayOfObject2[j] = localObject;
    break;
    if (localTypeDeserializer == null)
    {
      localObject = this._elementDeserializer.deserialize(paramJsonParser, paramDeserializationContext);
      break label63;
    }
    localObject = this._elementDeserializer.deserializeWithType(paramJsonParser, paramDeserializationContext, localTypeDeserializer);
    break label63;
    if (this._untyped);
    for (Object[] arrayOfObject3 = localObjectBuffer.completeAndClearBuffer(arrayOfObject2, i); ; arrayOfObject3 = localObjectBuffer.completeAndClearBuffer(arrayOfObject2, i, this._elementClass))
    {
      paramDeserializationContext.returnObjectBuffer(localObjectBuffer);
      return arrayOfObject3;
    }
  }
}
项目:ingress-indonesia-dev    文件:PrimitiveArrayDeserializers$StringDeser.java   
public final String[] deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
{
  if (!paramJsonParser.isExpectedStartArrayToken())
    return handleNonArray(paramJsonParser, paramDeserializationContext);
  ObjectBuffer localObjectBuffer = paramDeserializationContext.leaseObjectBuffer();
  Object[] arrayOfObject = localObjectBuffer.resetAndStart();
  int i = 0;
  JsonToken localJsonToken = paramJsonParser.nextToken();
  String str;
  if (localJsonToken != JsonToken.END_ARRAY)
    if (localJsonToken == JsonToken.VALUE_NULL)
    {
      str = null;
      label53: if (i < arrayOfObject.length)
        break label120;
      arrayOfObject = localObjectBuffer.appendCompletedChunk(arrayOfObject);
    }
  label120: for (int j = 0; ; j = i)
  {
    i = j + 1;
    arrayOfObject[j] = str;
    break;
    str = paramJsonParser.getText();
    break label53;
    String[] arrayOfString = (String[])localObjectBuffer.completeAndClearBuffer(arrayOfObject, i, String.class);
    paramDeserializationContext.returnObjectBuffer(localObjectBuffer);
    return arrayOfString;
  }
}
项目:ingress-indonesia-dev    文件:StdDeserializationContext.java   
public final ObjectBuffer leaseObjectBuffer()
{
  ObjectBuffer localObjectBuffer = this._objectBuffer;
  if (localObjectBuffer == null)
    return new ObjectBuffer();
  this._objectBuffer = null;
  return localObjectBuffer;
}
项目:12306-android-Decompile    文件:ArrayDeserializer.java   
public Object[] deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  if (!paramJsonParser.isExpectedStartArrayToken())
    return handleNonArray(paramJsonParser, paramDeserializationContext);
  ObjectBuffer localObjectBuffer = paramDeserializationContext.leaseObjectBuffer();
  Object[] arrayOfObject1 = localObjectBuffer.resetAndStart();
  int i = 0;
  TypeDeserializer localTypeDeserializer = this._elementTypeDeserializer;
  JsonToken localJsonToken = paramJsonParser.nextToken();
  if (localJsonToken != JsonToken.END_ARRAY)
  {
    Object localObject;
    if (localJsonToken == JsonToken.VALUE_NULL)
      localObject = null;
    while (true)
    {
      if (i >= arrayOfObject1.length)
      {
        arrayOfObject1 = localObjectBuffer.appendCompletedChunk(arrayOfObject1);
        i = 0;
      }
      int j = i + 1;
      arrayOfObject1[i] = localObject;
      i = j;
      break;
      if (localTypeDeserializer == null)
      {
        localObject = this._elementDeserializer.deserialize(paramJsonParser, paramDeserializationContext);
        continue;
      }
      localObject = this._elementDeserializer.deserializeWithType(paramJsonParser, paramDeserializationContext, localTypeDeserializer);
    }
  }
  if (this._untyped);
  for (Object[] arrayOfObject2 = localObjectBuffer.completeAndClearBuffer(arrayOfObject1, i); ; arrayOfObject2 = localObjectBuffer.completeAndClearBuffer(arrayOfObject1, i, this._elementClass))
  {
    paramDeserializationContext.returnObjectBuffer(localObjectBuffer);
    return arrayOfObject2;
  }
}
项目:12306-android-Decompile    文件:StdDeserializationContext.java   
public final void returnObjectBuffer(ObjectBuffer paramObjectBuffer)
{
  if ((this._objectBuffer == null) || (paramObjectBuffer.initialCapacity() >= this._objectBuffer.initialCapacity()))
    this._objectBuffer = paramObjectBuffer;
}
项目:RHome    文件:ArrayDeserializer.java   
public Object deserialize(JsonParser jp, DeserializationContext ctxt)
    throws IOException, JsonProcessingException
{
    // Ok: must point to START_ARRAY
    if (jp.getCurrentToken() != JsonToken.START_ARRAY) {
        /* 04-Oct-2009, tatu: One exception; byte arrays are generally
         *   serialized as base64, so that should be handled
         */
        if (jp.getCurrentToken() == JsonToken.VALUE_STRING
            && _elementClass == Byte.class) {
            return deserializeFromBase64(jp, ctxt);
        }
        throw ctxt.mappingException(_arrayType.getRawClass());
    }

    final ObjectBuffer buffer = ctxt.leaseObjectBuffer();
    Object[] chunk = buffer.resetAndStart();
    int ix = 0;
    JsonToken t;
    final TypeDeserializer typeDeser = _elementTypeDeserializer;

    while ((t = jp.nextToken()) != JsonToken.END_ARRAY) {
        // Note: must handle null explicitly here; value deserializers won't
        Object value;

        if (t == JsonToken.VALUE_NULL) {
            value = null;
        } else if (typeDeser == null) {
            value = _elementDeserializer.deserialize(jp, ctxt);
        } else {
            value = _elementDeserializer.deserializeWithType(jp, ctxt, typeDeser);
        }
        if (ix >= chunk.length) {
            chunk = buffer.appendCompletedChunk(chunk);
            ix = 0;
        }
        chunk[ix++] = value;
    }

    Object[] result;

    if (_untyped) {
        result = buffer.completeAndClearBuffer(chunk, ix);
    } else {
        result = buffer.completeAndClearBuffer(chunk, ix, _elementClass);
    }
    ctxt.returnObjectBuffer(buffer);
    return result;
}
项目:12306-android-Decompile    文件:ArrayDeserializer.java   
public Object[] deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  if (!paramJsonParser.isExpectedStartArrayToken())
    return handleNonArray(paramJsonParser, paramDeserializationContext);
  ObjectBuffer localObjectBuffer = paramDeserializationContext.leaseObjectBuffer();
  Object[] arrayOfObject1 = localObjectBuffer.resetAndStart();
  int i = 0;
  TypeDeserializer localTypeDeserializer = this._elementTypeDeserializer;
  JsonToken localJsonToken = paramJsonParser.nextToken();
  if (localJsonToken != JsonToken.END_ARRAY)
  {
    Object localObject;
    if (localJsonToken == JsonToken.VALUE_NULL)
      localObject = null;
    while (true)
    {
      if (i >= arrayOfObject1.length)
      {
        arrayOfObject1 = localObjectBuffer.appendCompletedChunk(arrayOfObject1);
        i = 0;
      }
      int j = i + 1;
      arrayOfObject1[i] = localObject;
      i = j;
      break;
      if (localTypeDeserializer == null)
      {
        localObject = this._elementDeserializer.deserialize(paramJsonParser, paramDeserializationContext);
        continue;
      }
      localObject = this._elementDeserializer.deserializeWithType(paramJsonParser, paramDeserializationContext, localTypeDeserializer);
    }
  }
  if (this._untyped);
  for (Object[] arrayOfObject2 = localObjectBuffer.completeAndClearBuffer(arrayOfObject1, i); ; arrayOfObject2 = localObjectBuffer.completeAndClearBuffer(arrayOfObject1, i, this._elementClass))
  {
    paramDeserializationContext.returnObjectBuffer(localObjectBuffer);
    return arrayOfObject2;
  }
}
项目:12306-android-Decompile    文件:StdDeserializationContext.java   
public final void returnObjectBuffer(ObjectBuffer paramObjectBuffer)
{
  if ((this._objectBuffer == null) || (paramObjectBuffer.initialCapacity() >= this._objectBuffer.initialCapacity()))
    this._objectBuffer = paramObjectBuffer;
}
项目:ingress-indonesia-dev    文件:StdDeserializationContext.java   
public final void returnObjectBuffer(ObjectBuffer paramObjectBuffer)
{
  if ((this._objectBuffer == null) || (paramObjectBuffer.initialCapacity() >= this._objectBuffer.initialCapacity()))
    this._objectBuffer = paramObjectBuffer;
}
项目:RHome    文件:DeserializationContext.java   
/**
 * Method that can be used to get access to a reusable ObjectBuffer,
 * useful for efficiently constructing Object arrays and Lists.
 * Note that leased buffers should be returned once deserializer
 * is done, to allow for reuse during same round of deserialization.
 */
public abstract ObjectBuffer leaseObjectBuffer();
项目:RHome    文件:DeserializationContext.java   
/**
 * Method to call to return object buffer previously leased with
 * {@link #leaseObjectBuffer}.
 * 
 * @param buf Returned object buffer
 */
public abstract void returnObjectBuffer(ObjectBuffer buf);
项目:12306-android-Decompile    文件:DeserializationContext.java   
public abstract ObjectBuffer leaseObjectBuffer();
项目:12306-android-Decompile    文件:DeserializationContext.java   
public abstract void returnObjectBuffer(ObjectBuffer paramObjectBuffer);
项目:12306-android-Decompile    文件:DeserializationContext.java   
public abstract ObjectBuffer leaseObjectBuffer();
项目:12306-android-Decompile    文件:DeserializationContext.java   
public abstract void returnObjectBuffer(ObjectBuffer paramObjectBuffer);
项目:ingress-indonesia-dev    文件:DeserializationContext.java   
public abstract ObjectBuffer leaseObjectBuffer();
项目:ingress-indonesia-dev    文件:DeserializationContext.java   
public abstract void returnObjectBuffer(ObjectBuffer paramObjectBuffer);