jackson-core-asl-1.9.13

16:36:55.857 INFO  jd.cli.Main - Decompiling jackson-core-asl-1.9.13.jar
package org.codehaus.jackson;

import java.util.Arrays;

public final class Base64Variant
{
  static final char PADDING_CHAR_NONE = '\000';
  public static final int BASE64_VALUE_INVALID = -1;
  public static final int BASE64_VALUE_PADDING = -2;
  private final int[] _asciiToBase64 = new int['?'];
  private final char[] _base64ToAsciiC = new char[64];
  private final byte[] _base64ToAsciiB = new byte[64];
  final String _name;
  final boolean _usesPadding;
  final char _paddingChar;
  final int _maxLineLength;
  
  public Base64Variant(String name, String base64Alphabet, boolean usesPadding, char paddingChar, int maxLineLength)
  {
    _name = name;
    _usesPadding = usesPadding;
    _paddingChar = paddingChar;
    _maxLineLength = maxLineLength;
    
    int alphaLen = base64Alphabet.length();
    if (alphaLen != 64) {
      throw new IllegalArgumentException("Base64Alphabet length must be exactly 64 (was " + alphaLen + ")");
    }
    base64Alphabet.getChars(0, alphaLen, _base64ToAsciiC, 0);
    Arrays.fill(_asciiToBase64, -1);
    for (int i = 0; i < alphaLen; i++)
    {
      char alpha = _base64ToAsciiC[i];
      _base64ToAsciiB[i] = ((byte)alpha);
      _asciiToBase64[alpha] = i;
    }
    if (usesPadding) {
      _asciiToBase64[paddingChar] = -2;
    }
  }
  
  public Base64Variant(Base64Variant base, String name, int maxLineLength)
  {
    this(base, name, _usesPadding, _paddingChar, maxLineLength);
  }
  
  public Base64Variant(Base64Variant base, String name, boolean usesPadding, char paddingChar, int maxLineLength)
  {
    _name = name;
    byte[] srcB = _base64ToAsciiB;
    System.arraycopy(srcB, 0, _base64ToAsciiB, 0, srcB.length);
    char[] srcC = _base64ToAsciiC;
    System.arraycopy(srcC, 0, _base64ToAsciiC, 0, srcC.length);
    int[] srcV = _asciiToBase64;
    System.arraycopy(srcV, 0, _asciiToBase64, 0, srcV.length);
    
    _usesPadding = usesPadding;
    _paddingChar = paddingChar;
    _maxLineLength = maxLineLength;
  }
  
  public String getName()
  {
    return _name;
  }
  
  public boolean usesPadding()
  {
    return _usesPadding;
  }
  
  public boolean usesPaddingChar(char c)
  {
    return c == _paddingChar;
  }
  
  public boolean usesPaddingChar(int ch)
  {
    return ch == _paddingChar;
  }
  
  public char getPaddingChar()
  {
    return _paddingChar;
  }
  
  public byte getPaddingByte()
  {
    return (byte)_paddingChar;
  }
  
  public int getMaxLineLength()
  {
    return _maxLineLength;
  }
  
  public int decodeBase64Char(char c)
  {
    int ch = c;
    return ch <= 127 ? _asciiToBase64[ch] : -1;
  }
  
  public int decodeBase64Char(int ch)
  {
    return ch <= 127 ? _asciiToBase64[ch] : -1;
  }
  
  public int decodeBase64Byte(byte b)
  {
    int ch = b;
    return ch <= 127 ? _asciiToBase64[ch] : -1;
  }
  
  public char encodeBase64BitsAsChar(int value)
  {
    return _base64ToAsciiC[value];
  }
  
  public int encodeBase64Chunk(int b24, char[] buffer, int ptr)
  {
    buffer[(ptr++)] = _base64ToAsciiC[(b24 >> 18 & 0x3F)];
    buffer[(ptr++)] = _base64ToAsciiC[(b24 >> 12 & 0x3F)];
    buffer[(ptr++)] = _base64ToAsciiC[(b24 >> 6 & 0x3F)];
    buffer[(ptr++)] = _base64ToAsciiC[(b24 & 0x3F)];
    return ptr;
  }
  
  public void encodeBase64Chunk(StringBuilder sb, int b24)
  {
    sb.append(_base64ToAsciiC[(b24 >> 18 & 0x3F)]);
    sb.append(_base64ToAsciiC[(b24 >> 12 & 0x3F)]);
    sb.append(_base64ToAsciiC[(b24 >> 6 & 0x3F)]);
    sb.append(_base64ToAsciiC[(b24 & 0x3F)]);
  }
  
  public int encodeBase64Partial(int bits, int outputBytes, char[] buffer, int outPtr)
  {
    buffer[(outPtr++)] = _base64ToAsciiC[(bits >> 18 & 0x3F)];
    buffer[(outPtr++)] = _base64ToAsciiC[(bits >> 12 & 0x3F)];
    if (_usesPadding)
    {
      buffer[(outPtr++)] = (outputBytes == 2 ? _base64ToAsciiC[(bits >> 6 & 0x3F)] : _paddingChar);
      
      buffer[(outPtr++)] = _paddingChar;
    }
    else if (outputBytes == 2)
    {
      buffer[(outPtr++)] = _base64ToAsciiC[(bits >> 6 & 0x3F)];
    }
    return outPtr;
  }
  
  public void encodeBase64Partial(StringBuilder sb, int bits, int outputBytes)
  {
    sb.append(_base64ToAsciiC[(bits >> 18 & 0x3F)]);
    sb.append(_base64ToAsciiC[(bits >> 12 & 0x3F)]);
    if (_usesPadding)
    {
      sb.append(outputBytes == 2 ? _base64ToAsciiC[(bits >> 6 & 0x3F)] : _paddingChar);
      
      sb.append(_paddingChar);
    }
    else if (outputBytes == 2)
    {
      sb.append(_base64ToAsciiC[(bits >> 6 & 0x3F)]);
    }
  }
  
  public byte encodeBase64BitsAsByte(int value)
  {
    return _base64ToAsciiB[value];
  }
  
  public int encodeBase64Chunk(int b24, byte[] buffer, int ptr)
  {
    buffer[(ptr++)] = _base64ToAsciiB[(b24 >> 18 & 0x3F)];
    buffer[(ptr++)] = _base64ToAsciiB[(b24 >> 12 & 0x3F)];
    buffer[(ptr++)] = _base64ToAsciiB[(b24 >> 6 & 0x3F)];
    buffer[(ptr++)] = _base64ToAsciiB[(b24 & 0x3F)];
    return ptr;
  }
  
  public int encodeBase64Partial(int bits, int outputBytes, byte[] buffer, int outPtr)
  {
    buffer[(outPtr++)] = _base64ToAsciiB[(bits >> 18 & 0x3F)];
    buffer[(outPtr++)] = _base64ToAsciiB[(bits >> 12 & 0x3F)];
    if (_usesPadding)
    {
      byte pb = (byte)_paddingChar;
      buffer[(outPtr++)] = (outputBytes == 2 ? _base64ToAsciiB[(bits >> 6 & 0x3F)] : pb);
      
      buffer[(outPtr++)] = pb;
    }
    else if (outputBytes == 2)
    {
      buffer[(outPtr++)] = _base64ToAsciiB[(bits >> 6 & 0x3F)];
    }
    return outPtr;
  }
  
  public String encode(byte[] input)
  {
    return encode(input, false);
  }
  
  public String encode(byte[] input, boolean addQuotes)
  {
    int inputEnd = input.length;
    
    int outputLen = inputEnd + (inputEnd >> 2) + (inputEnd >> 3);
    StringBuilder sb = new StringBuilder(outputLen);
    if (addQuotes) {
      sb.append('"');
    }
    int chunksBeforeLF = getMaxLineLength() >> 2;
    
    int inputPtr = 0;
    int safeInputEnd = inputEnd - 3;
    while (inputPtr <= safeInputEnd)
    {
      int b24 = input[(inputPtr++)] << 8;
      b24 |= input[(inputPtr++)] & 0xFF;
      b24 = b24 << 8 | input[(inputPtr++)] & 0xFF;
      encodeBase64Chunk(sb, b24);
      chunksBeforeLF--;
      if (chunksBeforeLF <= 0)
      {
        sb.append('\\');
        sb.append('n');
        chunksBeforeLF = getMaxLineLength() >> 2;
      }
    }
    int inputLeft = inputEnd - inputPtr;
    if (inputLeft > 0)
    {
      int b24 = input[(inputPtr++)] << 16;
      if (inputLeft == 2) {
        b24 |= (input[(inputPtr++)] & 0xFF) << 8;
      }
      encodeBase64Partial(sb, b24, inputLeft);
    }
    if (addQuotes) {
      sb.append('"');
    }
    return sb.toString();
  }
  
  public String toString()
  {
    return _name;
  }
}

/* Location:
 * Qualified Name:     org.codehaus.jackson.Base64Variant
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.codehaus.jackson;

public final class Base64Variants
{
  static final String STD_BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  public static final Base64Variant MIME = new Base64Variant("MIME", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", true, '=', 76);
  public static final Base64Variant MIME_NO_LINEFEEDS = new Base64Variant(MIME, "MIME-NO-LINEFEEDS", Integer.MAX_VALUE);
  public static final Base64Variant PEM = new Base64Variant(MIME, "PEM", true, '=', 64);
  public static final Base64Variant MODIFIED_FOR_URL;
  
  static
  {
    StringBuffer sb = new StringBuffer("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
    
    sb.setCharAt(sb.indexOf("+"), '-');
    sb.setCharAt(sb.indexOf("/"), '_');
    
    MODIFIED_FOR_URL = new Base64Variant("MODIFIED-FOR-URL", sb.toString(), false, '\000', Integer.MAX_VALUE);
  }
  
  public static Base64Variant getDefaultVariant()
  {
    return MIME_NO_LINEFEEDS;
  }
}

/* Location:
 * Qualified Name:     org.codehaus.jackson.Base64Variants
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.codehaus.jackson;

public abstract interface FormatSchema
{
  public abstract String getSchemaType();
}

/* Location:
 * Qualified Name:     org.codehaus.jackson.FormatSchema
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.codehaus.jackson;

public enum JsonEncoding
{
  UTF8("UTF-8", false),  UTF16_BE("UTF-16BE", true),  UTF16_LE("UTF-16LE", false),  UTF32_BE("UTF-32BE", true),  UTF32_LE("UTF-32LE", false);
  
  protected final String _javaName;
  protected final boolean _bigEndian;
  
  private JsonEncoding(String javaName, boolean bigEndian)
  {
    _javaName = javaName;
    _bigEndian = bigEndian;
  }
  
  public String getJavaName()
  {
    return _javaName;
  }
  
  public boolean isBigEndian()
  {
    return _bigEndian;
  }
}

/* Location:
 * Qualified Name:     org.codehaus.jackson.JsonEncoding
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.codehaus.jackson;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.StringReader;
import java.io.Writer;
import java.lang.ref.SoftReference;
import java.net.URL;
import org.codehaus.jackson.format.InputAccessor;
import org.codehaus.jackson.format.MatchStrength;
import org.codehaus.jackson.impl.ByteSourceBootstrapper;
import org.codehaus.jackson.impl.ReaderBasedParser;
import org.codehaus.jackson.impl.Utf8Generator;
import org.codehaus.jackson.impl.WriterBasedGenerator;
import org.codehaus.jackson.io.CharacterEscapes;
import org.codehaus.jackson.io.IOContext;
import org.codehaus.jackson.io.InputDecorator;
import org.codehaus.jackson.io.OutputDecorator;
import org.codehaus.jackson.io.UTF8Writer;
import org.codehaus.jackson.sym.BytesToNameCanonicalizer;
import org.codehaus.jackson.sym.CharsToNameCanonicalizer;
import org.codehaus.jackson.util.BufferRecycler;
import org.codehaus.jackson.util.VersionUtil;

public class JsonFactory
  implements Versioned
{
  public static final String FORMAT_NAME_JSON = "JSON";
  static final int DEFAULT_PARSER_FEATURE_FLAGS = ;
  static final int DEFAULT_GENERATOR_FEATURE_FLAGS = JsonGenerator.Feature.collectDefaults();
  protected static final ThreadLocal<SoftReference<BufferRecycler>> _recyclerRef = new ThreadLocal();
  protected CharsToNameCanonicalizer _rootCharSymbols = CharsToNameCanonicalizer.createRoot();
  protected BytesToNameCanonicalizer _rootByteSymbols = BytesToNameCanonicalizer.createRoot();
  protected ObjectCodec _objectCodec;
  protected int _parserFeatures = DEFAULT_PARSER_FEATURE_FLAGS;
  protected int _generatorFeatures = DEFAULT_GENERATOR_FEATURE_FLAGS;
  protected CharacterEscapes _characterEscapes;
  protected InputDecorator _inputDecorator;
  protected OutputDecorator _outputDecorator;
  
  public JsonFactory()
  {
    this(null);
  }
  
  public JsonFactory(ObjectCodec oc)
  {
    _objectCodec = oc;
  }
  
  public String getFormatName()
  {
    if (getClass() == JsonFactory.class) {
      return "JSON";
    }
    return null;
  }
  
  public MatchStrength hasFormat(InputAccessor acc)
    throws IOException
  {
    if (getClass() == JsonFactory.class) {
      return hasJSONFormat(acc);
    }
    return null;
  }
  
  protected MatchStrength hasJSONFormat(InputAccessor acc)
    throws IOException
  {
    return ByteSourceBootstrapper.hasJSONFormat(acc);
  }
  
  public Version version()
  {
    return VersionUtil.versionFor(Utf8Generator.class);
  }
  
  public final JsonFactory configure(JsonParser.Feature f, boolean state)
  {
    if (state) {
      enable(f);
    } else {
      disable(f);
    }
    return this;
  }
  
  public JsonFactory enable(JsonParser.Feature f)
  {
    _parserFeatures |= f.getMask();
    return this;
  }
  
  public JsonFactory disable(JsonParser.Feature f)
  {
    _parserFeatures &= (f.getMask() ^ 0xFFFFFFFF);
    return this;
  }
  
  public final boolean isEnabled(JsonParser.Feature f)
  {
    return (_parserFeatures & f.getMask()) != 0;
  }
  
  /**
   * @deprecated
   */
  public final void enableParserFeature(JsonParser.Feature f)
  {
    enable(f);
  }
  
  /**
   * @deprecated
   */
  public final void disableParserFeature(JsonParser.Feature f)
  {
    disable(f);
  }
  
  /**
   * @deprecated
   */
  public final void setParserFeature(JsonParser.Feature f, boolean state)
  {
    configure(f, state);
  }
  
  /**
   * @deprecated
   */
  public final boolean isParserFeatureEnabled(JsonParser.Feature f)
  {
    return (_parserFeatures & f.getMask()) != 0;
  }
  
  public InputDecorator getInputDecorator()
  {
    return _inputDecorator;
  }
  
  public JsonFactory setInputDecorator(InputDecorator d)
  {
    _inputDecorator = d;
    return this;
  }
  
  public final JsonFactory configure(JsonGenerator.Feature f, boolean state)
  {
    if (state) {
      enable(f);
    } else {
      disable(f);
    }
    return this;
  }
  
  public JsonFactory enable(JsonGenerator.Feature f)
  {
    _generatorFeatures |= f.getMask();
    return this;
  }
  
  public JsonFactory disable(JsonGenerator.Feature f)
  {
    _generatorFeatures &= (f.getMask() ^ 0xFFFFFFFF);
    return this;
  }
  
  public final boolean isEnabled(JsonGenerator.Feature f)
  {
    return (_generatorFeatures & f.getMask()) != 0;
  }
  
  @Deprecated
  public final void enableGeneratorFeature(JsonGenerator.Feature f)
  {
    enable(f);
  }
  
  @Deprecated
  public final void disableGeneratorFeature(JsonGenerator.Feature f)
  {
    disable(f);
  }
  
  @Deprecated
  public final void setGeneratorFeature(JsonGenerator.Feature f, boolean state)
  {
    configure(f, state);
  }
  
  @Deprecated
  public final boolean isGeneratorFeatureEnabled(JsonGenerator.Feature f)
  {
    return isEnabled(f);
  }
  
  public CharacterEscapes getCharacterEscapes()
  {
    return _characterEscapes;
  }
  
  public JsonFactory setCharacterEscapes(CharacterEscapes esc)
  {
    _characterEscapes = esc;
    return this;
  }
  
  public OutputDecorator getOutputDecorator()
  {
    return _outputDecorator;
  }
  
  public JsonFactory setOutputDecorator(OutputDecorator d)
  {
    _outputDecorator = d;
    return this;
  }
  
  public JsonFactory setCodec(ObjectCodec oc)
  {
    _objectCodec = oc;
    return this;
  }
  
  public ObjectCodec getCodec()
  {
    return _objectCodec;
  }
  
  public JsonParser createJsonParser(File f)
    throws IOException, JsonParseException
  {
    IOContext ctxt = _createContext(f, true);
    InputStream in = new FileInputStream(f);
    if (_inputDecorator != null) {
      in = _inputDecorator.decorate(ctxt, in);
    }
    return _createJsonParser(in, ctxt);
  }
  
  public JsonParser createJsonParser(URL url)
    throws IOException, JsonParseException
  {
    IOContext ctxt = _createContext(url, true);
    InputStream in = _optimizedStreamFromURL(url);
    if (_inputDecorator != null) {
      in = _inputDecorator.decorate(ctxt, in);
    }
    return _createJsonParser(in, ctxt);
  }
  
  public JsonParser createJsonParser(InputStream in)
    throws IOException, JsonParseException
  {
    IOContext ctxt = _createContext(in, false);
    if (_inputDecorator != null) {
      in = _inputDecorator.decorate(ctxt, in);
    }
    return _createJsonParser(in, ctxt);
  }
  
  public JsonParser createJsonParser(Reader r)
    throws IOException, JsonParseException
  {
    IOContext ctxt = _createContext(r, false);
    if (_inputDecorator != null) {
      r = _inputDecorator.decorate(ctxt, r);
    }
    return _createJsonParser(r, ctxt);
  }
  
  public JsonParser createJsonParser(byte[] data)
    throws IOException, JsonParseException
  {
    IOContext ctxt = _createContext(data, true);
    if (_inputDecorator != null)
    {
      InputStream in = _inputDecorator.decorate(ctxt, data, 0, data.length);
      if (in != null) {
        return _createJsonParser(in, ctxt);
      }
    }
    return _createJsonParser(data, 0, data.length, ctxt);
  }
  
  public JsonParser createJsonParser(byte[] data, int offset, int len)
    throws IOException, JsonParseException
  {
    IOContext ctxt = _createContext(data, true);
    if (_inputDecorator != null)
    {
      InputStream in = _inputDecorator.decorate(ctxt, data, offset, len);
      if (in != null) {
        return _createJsonParser(in, ctxt);
      }
    }
    return _createJsonParser(data, offset, len, ctxt);
  }
  
  public JsonParser createJsonParser(String content)
    throws IOException, JsonParseException
  {
    Reader r = new StringReader(content);
    
    IOContext ctxt = _createContext(r, true);
    if (_inputDecorator != null) {
      r = _inputDecorator.decorate(ctxt, r);
    }
    return _createJsonParser(r, ctxt);
  }
  
  public JsonGenerator createJsonGenerator(OutputStream out, JsonEncoding enc)
    throws IOException
  {
    IOContext ctxt = _createContext(out, false);
    ctxt.setEncoding(enc);
    if (enc == JsonEncoding.UTF8)
    {
      if (_outputDecorator != null) {
        out = _outputDecorator.decorate(ctxt, out);
      }
      return _createUTF8JsonGenerator(out, ctxt);
    }
    Writer w = _createWriter(out, enc, ctxt);
    if (_outputDecorator != null) {
      w = _outputDecorator.decorate(ctxt, w);
    }
    return _createJsonGenerator(w, ctxt);
  }
  
  public JsonGenerator createJsonGenerator(Writer out)
    throws IOException
  {
    IOContext ctxt = _createContext(out, false);
    if (_outputDecorator != null) {
      out = _outputDecorator.decorate(ctxt, out);
    }
    return _createJsonGenerator(out, ctxt);
  }
  
  public JsonGenerator createJsonGenerator(OutputStream out)
    throws IOException
  {
    return createJsonGenerator(out, JsonEncoding.UTF8);
  }
  
  public JsonGenerator createJsonGenerator(File f, JsonEncoding enc)
    throws IOException
  {
    OutputStream out = new FileOutputStream(f);
    
    IOContext ctxt = _createContext(out, true);
    ctxt.setEncoding(enc);
    if (enc == JsonEncoding.UTF8)
    {
      if (_outputDecorator != null) {
        out = _outputDecorator.decorate(ctxt, out);
      }
      return _createUTF8JsonGenerator(out, ctxt);
    }
    Writer w = _createWriter(out, enc, ctxt);
    if (_outputDecorator != null) {
      w = _outputDecorator.decorate(ctxt, w);
    }
    return _createJsonGenerator(w, ctxt);
  }
  
  protected JsonParser _createJsonParser(InputStream in, IOContext ctxt)
    throws IOException, JsonParseException
  {
    return new ByteSourceBootstrapper(ctxt, in).constructParser(_parserFeatures, _objectCodec, _rootByteSymbols, _rootCharSymbols);
  }
  
  protected JsonParser _createJsonParser(Reader r, IOContext ctxt)
    throws IOException, JsonParseException
  {
    return new ReaderBasedParser(ctxt, _parserFeatures, r, _objectCodec, _rootCharSymbols.makeChild(isEnabled(JsonParser.Feature.CANONICALIZE_FIELD_NAMES), isEnabled(JsonParser.Feature.INTERN_FIELD_NAMES)));
  }
  
  protected JsonParser _createJsonParser(byte[] data, int offset, int len, IOContext ctxt)
    throws IOException, JsonParseException
  {
    return new ByteSourceBootstrapper(ctxt, data, offset, len).constructParser(_parserFeatures, _objectCodec, _rootByteSymbols, _rootCharSymbols);
  }
  
  protected JsonGenerator _createJsonGenerator(Writer out, IOContext ctxt)
    throws IOException
  {
    WriterBasedGenerator gen = new WriterBasedGenerator(ctxt, _generatorFeatures, _objectCodec, out);
    if (_characterEscapes != null) {
      gen.setCharacterEscapes(_characterEscapes);
    }
    return gen;
  }
  
  protected JsonGenerator _createUTF8JsonGenerator(OutputStream out, IOContext ctxt)
    throws IOException
  {
    Utf8Generator gen = new Utf8Generator(ctxt, _generatorFeatures, _objectCodec, out);
    if (_characterEscapes != null) {
      gen.setCharacterEscapes(_characterEscapes);
    }
    return gen;
  }
  
  protected Writer _createWriter(OutputStream out, JsonEncoding enc, IOContext ctxt)
    throws IOException
  {
    if (enc == JsonEncoding.UTF8) {
      return new UTF8Writer(ctxt, out);
    }
    return new OutputStreamWriter(out, enc.getJavaName());
  }
  
  protected IOContext _createContext(Object srcRef, boolean resourceManaged)
  {
    return new IOContext(_getBufferRecycler(), srcRef, resourceManaged);
  }
  
  public BufferRecycler _getBufferRecycler()
  {
    SoftReference<BufferRecycler> ref = (SoftReference)_recyclerRef.get();
    BufferRecycler br = ref == null ? null : (BufferRecycler)ref.get();
    if (br == null)
    {
      br = new BufferRecycler();
      _recyclerRef.set(new SoftReference(br));
    }
    return br;
  }
  
  protected InputStream _optimizedStreamFromURL(URL url)
    throws IOException
  {
    if ("file".equals(url.getProtocol()))
    {
      String host = url.getHost();
      if ((host == null) || (host.length() == 0)) {
        return new FileInputStream(url.getPath());
      }
    }
    return url.openStream();
  }
}

/* Location:
 * Qualified Name:     org.codehaus.jackson.JsonFactory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.codehaus.jackson;

public class JsonGenerationException
  extends JsonProcessingException
{
  static final long serialVersionUID = 123L;
  
  public JsonGenerationException(Throwable rootCause)
  {
    super(rootCause);
  }
  
  public JsonGenerationException(String msg)
  {
    super(msg, (JsonLocation)null);
  }
  
  public JsonGenerationException(String msg, Throwable rootCause)
  {
    super(msg, (JsonLocation)null, rootCause);
  }
}

/* Location:
 * Qualified Name:     org.codehaus.jackson.JsonGenerationException
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.codehaus.jackson;

public enum JsonGenerator$Feature
{
  AUTO_CLOSE_TARGET(true),  AUTO_CLOSE_JSON_CONTENT(true),  QUOTE_FIELD_NAMES(true),  QUOTE_NON_NUMERIC_NUMBERS(true),  WRITE_NUMBERS_AS_STRINGS(false),  FLUSH_PASSED_TO_STREAM(true),  ESCAPE_NON_ASCII(false);
  
  final boolean _defaultState;
  final int _mask;
  
  public static int collectDefaults()
  {
    int flags = 0;
    for (Feature f : values()) {
      if (f.enabledByDefault()) {
        flags |= f.getMask();
      }
    }
    return flags;
  }
  
  private JsonGenerator$Feature(boolean defaultState)
  {
    _defaultState = defaultState;
    _mask = (1 << ordinal());
  }
  
  public boolean enabledByDefault()
  {
    return _defaultState;
  }
  
  public int getMask()
  {
    return _mask;
  }
}

/* Location:
 * Qualified Name:     org.codehaus.jackson.JsonGenerator.Feature
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.codehaus.jackson;

import java.io.Closeable;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import org.codehaus.jackson.io.CharacterEscapes;
import org.codehaus.jackson.io.SerializedString;

public abstract class JsonGenerator
  implements Closeable, Versioned
{
  protected PrettyPrinter _cfgPrettyPrinter;
  
  public static enum Feature
  {
    AUTO_CLOSE_TARGET(true),  AUTO_CLOSE_JSON_CONTENT(true),  QUOTE_FIELD_NAMES(true),  QUOTE_NON_NUMERIC_NUMBERS(true),  WRITE_NUMBERS_AS_STRINGS(false),  FLUSH_PASSED_TO_STREAM(true),  ESCAPE_NON_ASCII(false);
    
    final boolean _defaultState;
    final int _mask;
    
    public static int collectDefaults()
    {
      int flags = 0;
      for (Feature f : values()) {
        if (f.enabledByDefault()) {
          flags |= f.getMask();
        }
      }
      return flags;
    }
    
    private Feature(boolean defaultState)
    {
      _defaultState = defaultState;
      _mask = (1 << ordinal());
    }
    
    public boolean enabledByDefault()
    {
      return _defaultState;
    }
    
    public int getMask()
    {
      return _mask;
    }
  }
  
  public void setSchema(FormatSchema schema)
  {
    throw new UnsupportedOperationException("Generator of type " + getClass().getName() + " does not support schema of type '" + schema.getSchemaType() + "'");
  }
  
  public boolean canUseSchema(FormatSchema schema)
  {
    return false;
  }
  
  public Version version()
  {
    return Version.unknownVersion();
  }
  
  public Object getOutputTarget()
  {
    return null;
  }
  
  public abstract JsonGenerator enable(Feature paramFeature);
  
  public abstract JsonGenerator disable(Feature paramFeature);
  
  public JsonGenerator configure(Feature f, boolean state)
  {
    if (state) {
      enable(f);
    } else {
      disable(f);
    }
    return this;
  }
  
  public abstract boolean isEnabled(Feature paramFeature);
  
  public abstract JsonGenerator setCodec(ObjectCodec paramObjectCodec);
  
  public abstract ObjectCodec getCodec();
  
  @Deprecated
  public void enableFeature(Feature f)
  {
    enable(f);
  }
  
  @Deprecated
  public void disableFeature(Feature f)
  {
    disable(f);
  }
  
  @Deprecated
  public void setFeature(Feature f, boolean state)
  {
    configure(f, state);
  }
  
  @Deprecated
  public boolean isFeatureEnabled(Feature f)
  {
    return isEnabled(f);
  }
  
  public JsonGenerator setPrettyPrinter(PrettyPrinter pp)
  {
    _cfgPrettyPrinter = pp;
    return this;
  }
  
  public abstract JsonGenerator useDefaultPrettyPrinter();
  
  public JsonGenerator setHighestNonEscapedChar(int charCode)
  {
    return this;
  }
  
  public int getHighestEscapedChar()
  {
    return 0;
  }
  
  public CharacterEscapes getCharacterEscapes()
  {
    return null;
  }
  
  public JsonGenerator setCharacterEscapes(CharacterEscapes esc)
  {
    return this;
  }
  
  public abstract void writeStartArray()
    throws IOException, JsonGenerationException;
  
  public abstract void writeEndArray()
    throws IOException, JsonGenerationException;
  
  public abstract void writeStartObject()
    throws IOException, JsonGenerationException;
  
  public abstract void writeEndObject()
    throws IOException, JsonGenerationException;
  
  public abstract void writeFieldName(String paramString)
    throws IOException, JsonGenerationException;
  
  public void writeFieldName(SerializedString name)
    throws IOException, JsonGenerationException
  {
    writeFieldName(name.getValue());
  }
  
  public void writeFieldName(SerializableString name)
    throws IOException, JsonGenerationException
  {
    writeFieldName(name.getValue());
  }
  
  public abstract void writeString(String paramString)
    throws IOException, JsonGenerationException;
  
  public abstract void writeString(char[] paramArrayOfChar, int paramInt1, int paramInt2)
    throws IOException, JsonGenerationException;
  
  public void writeString(SerializableString text)
    throws IOException, JsonGenerationException
  {
    writeString(text.getValue());
  }
  
  public abstract void writeRawUTF8String(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws IOException, JsonGenerationException;
  
  public abstract void writeUTF8String(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws IOException, JsonGenerationException;
  
  public abstract void writeRaw(String paramString)
    throws IOException, JsonGenerationException;
  
  public abstract void writeRaw(String paramString, int paramInt1, int paramInt2)
    throws IOException, JsonGenerationException;
  
  public abstract void writeRaw(char[] paramArrayOfChar, int paramInt1, int paramInt2)
    throws IOException, JsonGenerationException;
  
  public abstract void writeRaw(char paramChar)
    throws IOException, JsonGenerationException;
  
  public abstract void writeRawValue(String paramString)
    throws IOException, JsonGenerationException;
  
  public abstract void writeRawValue(String paramString, int paramInt1, int paramInt2)
    throws IOException, JsonGenerationException;
  
  public abstract void writeRawValue(char[] paramArrayOfChar, int paramInt1, int paramInt2)
    throws IOException, JsonGenerationException;
  
  public abstract void writeBinary(Base64Variant paramBase64Variant, byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws IOException, JsonGenerationException;
  
  public void writeBinary(byte[] data, int offset, int len)
    throws IOException, JsonGenerationException
  {
    writeBinary(Base64Variants.getDefaultVariant(), data, offset, len);
  }
  
  public void writeBinary(byte[] data)
    throws IOException, JsonGenerationException
  {
    writeBinary(Base64Variants.getDefaultVariant(), data, 0, data.length);
  }
  
  public abstract void writeNumber(int paramInt)
    throws IOException, JsonGenerationException;
  
  public abstract void writeNumber(long paramLong)
    throws IOException, JsonGenerationException;
  
  public abstract void writeNumber(BigInteger paramBigInteger)
    throws IOException, JsonGenerationException;
  
  public abstract void writeNumber(double paramDouble)
    throws IOException, JsonGenerationException;
  
  public abstract void writeNumber(float paramFloat)
    throws IOException, JsonGenerationException;
  
  public abstract void writeNumber(BigDecimal paramBigDecimal)
    throws IOException, JsonGenerationException;
  
  public abstract void writeNumber(String paramString)
    throws IOException, JsonGenerationException, UnsupportedOperationException;
  
  public abstract void writeBoolean(boolean paramBoolean)
    throws IOException, JsonGenerationException;
  
  public abstract void writeNull()
    throws IOException, JsonGenerationException;
  
  public abstract void writeObject(Object paramObject)
    throws IOException, JsonProcessingException;
  
  public abstract void writeTree(JsonNode paramJsonNode)
    throws IOException, JsonProcessingException;
  
  public void writeStringField(String fieldName, String value)
    throws IOException, JsonGenerationException
  {
    writeFieldName(fieldName);
    writeString(value);
  }
  
  public final void writeBooleanField(String fieldName, boolean value)
    throws IOException, JsonGenerationException
  {
    writeFieldName(fieldName);
    writeBoolean(value);
  }
  
  public final void writeNullField(String fieldName)
    throws IOException, JsonGenerationException
  {
    writeFieldName(fieldName);
    writeNull();
  }
  
  public final void writeNumberField(String fieldName, int value)
    throws IOException, JsonGenerationException
  {
    writeFieldName(fieldName);
    writeNumber(value);
  }
  
  public final void writeNumberField(String fieldName, long value)
    throws IOException, JsonGenerationException
  {
    writeFieldName(fieldName);
    writeNumber(value);
  }
  
  public final void writeNumberField(String fieldName, double value)
    throws IOException, JsonGenerationException
  {
    writeFieldName(fieldName);
    writeNumber(value);
  }
  
  public final void writeNumberField(String fieldName, float value)
    throws IOException, JsonGenerationException
  {
    writeFieldName(fieldName);
    writeNumber(value);
  }
  
  public final void writeNumberField(String fieldName, BigDecimal value)
    throws IOException, JsonGenerationException
  {
    writeFieldName(fieldName);
    writeNumber(value);
  }
  
  public final void writeBinaryField(String fieldName, byte[] data)
    throws IOException, JsonGenerationException
  {
    writeFieldName(fieldName);
    writeBinary(data);
  }
  
  public final void writeArrayFieldStart(String fieldName)
    throws IOException, JsonGenerationException
  {
    writeFieldName(fieldName);
    writeStartArray();
  }
  
  public final void writeObjectFieldStart(String fieldName)
    throws IOException, JsonGenerationException
  {
    writeFieldName(fieldName);
    writeStartObject();
  }
  
  public final void writeObjectField(String fieldName, Object pojo)
    throws IOException, JsonProcessingException
  {
    writeFieldName(fieldName);
    writeObject(pojo);
  }
  
  public abstract void copyCurrentEvent(JsonParser paramJsonParser)
    throws IOException, JsonProcessingException;
  
  public abstract void copyCurrentStructure(JsonParser paramJsonParser)
    throws IOException, JsonProcessingException;
  
  public abstract JsonStreamContext getOutputContext();
  
  public abstract void flush()
    throws IOException;
  
  public abstract boolean isClosed();
  
  public abstract void close()
    throws IOException;
}

/* Location:
 * Qualified Name:     org.codehaus.jackson.JsonGenerator
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.codehaus.jackson;

import java.io.Serializable;
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonProperty;

public class JsonLocation
  implements Serializable
{
  private static final long serialVersionUID = 1L;
  public static final JsonLocation NA = new JsonLocation("N/A", -1L, -1L, -1, -1);
  final long _totalBytes;
  final long _totalChars;
  final int _lineNr;
  final int _columnNr;
  final Object _sourceRef;
  
  public JsonLocation(Object srcRef, long totalChars, int lineNr, int colNr)
  {
    this(srcRef, -1L, totalChars, lineNr, colNr);
  }
  
  @JsonCreator
  public JsonLocation(@JsonProperty("sourceRef") Object sourceRef, @JsonProperty("byteOffset") long totalBytes, @JsonProperty("charOffset") long totalChars, @JsonProperty("lineNr") int lineNr, @JsonProperty("columnNr") int columnNr)
  {
    _sourceRef = sourceRef;
    _totalBytes = totalBytes;
    _totalChars = totalChars;
    _lineNr = lineNr;
    _columnNr = columnNr;
  }
  
  public Object getSourceRef()
  {
    return _sourceRef;
  }
  
  public int getLineNr()
  {
    return _lineNr;
  }
  
  public int getColumnNr()
  {
    return _columnNr;
  }
  
  public long getCharOffset()
  {
    return _totalChars;
  }
  
  public long getByteOffset()
  {
    return _totalBytes;
  }
  
  public String toString()
  {
    StringBuilder sb = new StringBuilder(80);
    sb.append("[Source: ");
    if (_sourceRef == null) {
      sb.append("UNKNOWN");
    } else {
      sb.append(_sourceRef.toString());
    }
    sb.append("; line: ");
    sb.append(_lineNr);
    sb.append(", column: ");
    sb.append(_columnNr);
    sb.append(']');
    return sb.toString();
  }
  
  public int hashCode()
  {
    int hash = _sourceRef == null ? 1 : _sourceRef.hashCode();
    hash ^= _lineNr;
    hash += _columnNr;
    hash ^= (int)_totalChars;
    hash += (int)_totalBytes;
    return hash;
  }
  
  public boolean equals(Object other)
  {
    if (other == this) {
      return true;
    }
    if (other == null) {
      return false;
    }
    if (!(other instanceof JsonLocation)) {
      return false;
    }
    JsonLocation otherLoc = (JsonLocation)other;
    if (_sourceRef == null)
    {
      if (_sourceRef != null) {
        return false;
      }
    }
    else if (!_sourceRef.equals(_sourceRef)) {
      return false;
    }
    return (_lineNr == _lineNr) && (_columnNr == _columnNr) && (_totalChars == _totalChars) && (getByteOffset() == otherLoc.getByteOffset());
  }
}

/* Location:
 * Qualified Name:     org.codehaus.jackson.JsonLocation
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.codehaus.jackson;

import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;

public abstract class JsonNode
  implements Iterable<JsonNode>
{
  protected static final List<JsonNode> NO_NODES = ;
  protected static final List<String> NO_STRINGS = Collections.emptyList();
  
  public boolean isValueNode()
  {
    return false;
  }
  
  public boolean isContainerNode()
  {
    return false;
  }
  
  public boolean isMissingNode()
  {
    return false;
  }
  
  public boolean isArray()
  {
    return false;
  }
  
  public boolean isObject()
  {
    return false;
  }
  
  public boolean isPojo()
  {
    return false;
  }
  
  public boolean isNumber()
  {
    return false;
  }
  
  public boolean isIntegralNumber()
  {
    return false;
  }
  
  public boolean isFloatingPointNumber()
  {
    return false;
  }
  
  public boolean isInt()
  {
    return false;
  }
  
  public boolean isLong()
  {
    return false;
  }
  
  public boolean isDouble()
  {
    return false;
  }
  
  public boolean isBigDecimal()
  {
    return false;
  }
  
  public boolean isBigInteger()
  {
    return false;
  }
  
  public boolean isTextual()
  {
    return false;
  }
  
  public boolean isBoolean()
  {
    return false;
  }
  
  public boolean isNull()
  {
    return false;
  }
  
  public boolean isBinary()
  {
    return false;
  }
  
  public abstract JsonToken asToken();
  
  public abstract JsonParser.NumberType getNumberType();
  
  public String getTextValue()
  {
    return null;
  }
  
  public byte[] getBinaryValue()
    throws IOException
  {
    return null;
  }
  
  public boolean getBooleanValue()
  {
    return false;
  }
  
  public Number getNumberValue()
  {
    return null;
  }
  
  public int getIntValue()
  {
    return 0;
  }
  
  public long getLongValue()
  {
    return 0L;
  }
  
  public double getDoubleValue()
  {
    return 0.0D;
  }
  
  public BigDecimal getDecimalValue()
  {
    return BigDecimal.ZERO;
  }
  
  public BigInteger getBigIntegerValue()
  {
    return BigInteger.ZERO;
  }
  
  public JsonNode get(int index)
  {
    return null;
  }
  
  public JsonNode get(String fieldName)
  {
    return null;
  }
  
  public abstract String asText();
  
  public int asInt()
  {
    return asInt(0);
  }
  
  public int asInt(int defaultValue)
  {
    return defaultValue;
  }
  
  public long asLong()
  {
    return asLong(0L);
  }
  
  public long asLong(long defaultValue)
  {
    return defaultValue;
  }
  
  public double asDouble()
  {
    return asDouble(0.0D);
  }
  
  public double asDouble(double defaultValue)
  {
    return defaultValue;
  }
  
  public boolean asBoolean()
  {
    return asBoolean(false);
  }
  
  public boolean asBoolean(boolean defaultValue)
  {
    return defaultValue;
  }
  
  @Deprecated
  public String getValueAsText()
  {
    return asText();
  }
  
  @Deprecated
  public int getValueAsInt()
  {
    return asInt(0);
  }
  
  @Deprecated
  public int getValueAsInt(int defaultValue)
  {
    return asInt(defaultValue);
  }
  
  @Deprecated
  public long getValueAsLong()
  {
    return asLong(0L);
  }
  
  @Deprecated
  public long getValueAsLong(long defaultValue)
  {
    return asLong(defaultValue);
  }
  
  @Deprecated
  public double getValueAsDouble()
  {
    return asDouble(0.0D);
  }
  
  @Deprecated
  public double getValueAsDouble(double defaultValue)
  {
    return asDouble(defaultValue);
  }
  
  @Deprecated
  public boolean getValueAsBoolean()
  {
    return asBoolean(false);
  }
  
  @Deprecated
  public boolean getValueAsBoolean(boolean defaultValue)
  {
    return asBoolean(defaultValue);
  }
  
  public boolean has(String fieldName)
  {
    return get(fieldName) != null;
  }
  
  public boolean has(int index)
  {
    return get(index) != null;
  }
  
  public abstract JsonNode findValue(String paramString);
  
  public final List<JsonNode> findValues(String fieldName)
  {
    List<JsonNode> result = findValues(fieldName, null);
    if (result == null) {
      return Collections.emptyList();
    }
    return result;
  }
  
  public final List<String> findValuesAsText(String fieldName)
  {
    List<String> result = findValuesAsText(fieldName, null);
    if (result == null) {
      return Collections.emptyList();
    }
    return result;
  }
  
  public abstract JsonNode findPath(String paramString);
  
  public abstract JsonNode findParent(String paramString);
  
  public final List<JsonNode> findParents(String fieldName)
  {
    List<JsonNode> result = findParents(fieldName, null);
    if (result == null) {
      return Collections.emptyList();
    }
    return result;
  }
  
  public abstract List<JsonNode> findValues(String paramString, List<JsonNode> paramList);
  
  public abstract List<String> findValuesAsText(String paramString, List<St
1 2 3 4 5 6 7 8 9 10 11 12 13 14

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd