You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2014/06/19 20:13:58 UTC
svn commit: r1603986 -
/manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/
Author: kwright
Date: Thu Jun 19 18:13:58 2014
New Revision: 1603986
URL: http://svn.apache.org/r1603986
Log:
Add ManifoldCF special streaming JSON generator
Added:
manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/
manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONArrayReader.java (with props)
manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONDoubleReader.java (with props)
manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONIntegerReader.java (with props)
manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONNameValueReader.java (with props)
manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONObjectReader.java (with props)
manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONReader.java (with props)
manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONStringReader.java (with props)
manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONValueReader.java (with props)
Added: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONArrayReader.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONArrayReader.java?rev=1603986&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONArrayReader.java (added)
+++ manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONArrayReader.java Thu Jun 19 18:13:58 2014
@@ -0,0 +1,89 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.core.jsongen;
+
+import java.io.*;
+import java.util.*;
+
+/** This class describes a JSON array reader. */
+public class JSONArrayReader extends JSONReader
+{
+ protected final static int STATE_PREBRACKET = 0;
+ protected final static int STATE_ELEMENT = 1;
+ protected final static int STATE_PREEND = 2;
+ protected final static int STATE_DONE = 3;
+
+ protected int state = STATE_PREBRACKET;
+ protected final List<JSONReader> elements = new ArrayList<JSONReader>();
+ protected int elementIndex;
+
+ public JSONArrayReader()
+ {
+ }
+
+ public JSONArrayReader addArrayElement(JSONReader element)
+ {
+ elements.add(element);
+ return this;
+ }
+
+ @Override
+ public int read()
+ throws IOException
+ {
+ int newState;
+ switch (state)
+ {
+ case STATE_PREBRACKET:
+ if (elements.size() == 0)
+ state = STATE_PREEND;
+ else
+ {
+ state = STATE_ELEMENT;
+ elementIndex = 0;
+ }
+ return '[';
+ case STATE_PREEND:
+ state = STATE_DONE;
+ return ']';
+ case STATE_DONE:
+ return -1;
+ case STATE_ELEMENT:
+ int x = elements.get(elementIndex).read();
+ if (x == -1)
+ {
+ elementIndex++;
+ if (elementIndex == elements.size())
+ {
+ state = STATE_DONE;
+ return ']';
+ }
+ else
+ return ',';
+ }
+ else
+ return x;
+ default:
+ throw new IllegalStateException("Unknown state: "+state);
+ }
+ }
+
+}
+
+
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONArrayReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONArrayReader.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONDoubleReader.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONDoubleReader.java?rev=1603986&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONDoubleReader.java (added)
+++ manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONDoubleReader.java Thu Jun 19 18:13:58 2014
@@ -0,0 +1,33 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.core.jsongen;
+
+import java.io.*;
+
+/** This class describes a JSON double reader. */
+public class JSONDoubleReader extends JSONValueReader
+{
+ public JSONDoubleReader(double value)
+ {
+ super(new StringReader(new Double(value).toString()));
+ }
+
+}
+
+
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONDoubleReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONDoubleReader.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONIntegerReader.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONIntegerReader.java?rev=1603986&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONIntegerReader.java (added)
+++ manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONIntegerReader.java Thu Jun 19 18:13:58 2014
@@ -0,0 +1,33 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.core.jsongen;
+
+import java.io.*;
+
+/** This class describes a JSON integer reader. */
+public class JSONIntegerReader extends JSONValueReader
+{
+ public JSONIntegerReader(int value)
+ {
+ super(new StringReader(Integer.toString(value)));
+ }
+
+}
+
+
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONIntegerReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONIntegerReader.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONNameValueReader.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONNameValueReader.java?rev=1603986&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONNameValueReader.java (added)
+++ manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONNameValueReader.java Thu Jun 19 18:13:58 2014
@@ -0,0 +1,73 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.core.jsongen;
+
+import java.io.*;
+
+/** This class describes a JSON name/value object reader. */
+public class JSONNameValueReader extends JSONObjectReader
+{
+ protected final static int STATE_NAME = 0;
+ protected final static int STATE_VALUE = 1;
+ protected final static int STATE_DONE = 2;
+
+ protected final JSONReader name;
+ protected final JSONReader value;
+
+ protected int state = STATE_NAME;
+
+ public JSONNameValueReader(JSONStringReader name, JSONObjectReader value)
+ {
+ this.name = name;
+ this.value = value;
+ }
+
+ @Override
+ public int read()
+ throws IOException
+ {
+ int x;
+ switch (state)
+ {
+ case STATE_NAME:
+ x = name.read();
+ if (x == -1)
+ {
+ state = STATE_VALUE;
+ return ':';
+ }
+ return x;
+ case STATE_VALUE:
+ x = value.read();
+ if (x == -1)
+ {
+ state = STATE_DONE;
+ return -1;
+ }
+ return x;
+ case STATE_DONE:
+ return -1;
+ default:
+ throw new IllegalStateException("Unknown state: "+state);
+ }
+ }
+
+}
+
+
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONNameValueReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONNameValueReader.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONObjectReader.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONObjectReader.java?rev=1603986&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONObjectReader.java (added)
+++ manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONObjectReader.java Thu Jun 19 18:13:58 2014
@@ -0,0 +1,88 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.core.jsongen;
+
+import java.io.*;
+import java.util.*;
+
+/** This class describes a JSON object reader. */
+public class JSONObjectReader extends JSONReader
+{
+ protected final static int STATE_PREBRACE = 0;
+ protected final static int STATE_PAIRBEGIN = 1;
+ protected final static int STATE_PREEND = 2;
+ protected final static int STATE_DONE = 3;
+
+ protected int state = STATE_PREBRACE;
+ protected final List<JSONReader> pairs = new ArrayList<JSONReader>();
+ protected int readerIndex;
+
+ public JSONObjectReader()
+ {
+ }
+
+ public JSONObjectReader addNameValuePair(JSONNameValueReader pair)
+ {
+ pairs.add(pair);
+ return this;
+ }
+
+ @Override
+ public int read()
+ throws IOException
+ {
+ switch (state)
+ {
+ case STATE_PREBRACE:
+ if (pairs.size() == 0)
+ state = STATE_PREEND;
+ else
+ {
+ state = STATE_PAIRBEGIN;
+ readerIndex = 0;
+ }
+ return '{';
+ case STATE_PREEND:
+ state = STATE_DONE;
+ return '}';
+ case STATE_DONE:
+ return -1;
+ case STATE_PAIRBEGIN:
+ int x = pairs.get(readerIndex).read();
+ if (x == -1)
+ {
+ readerIndex++;
+ if (readerIndex == pairs.size())
+ {
+ state = STATE_DONE;
+ return '}';
+ }
+ else
+ return ',';
+ }
+ else
+ return x;
+ default:
+ throw new IllegalStateException("Unknown state: "+state);
+ }
+ }
+
+}
+
+
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONObjectReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONObjectReader.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONReader.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONReader.java?rev=1603986&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONReader.java (added)
+++ manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONReader.java Thu Jun 19 18:13:58 2014
@@ -0,0 +1,60 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.core.jsongen;
+
+import java.io.*;
+
+/** This base class describes a JSON reader. */
+public abstract class JSONReader extends Reader
+{
+
+ @Override
+ public int read(char[] cbuf, int off, int len)
+ throws IOException
+ {
+ int amt = 0;
+ while (true)
+ {
+ if (len == 0)
+ return amt;
+ int theChar = read();
+ if (theChar == -1)
+ {
+ if (amt == 0)
+ return -1;
+ return amt;
+ }
+ cbuf[off++] = (char)theChar;
+ len--;
+ }
+ }
+
+ @Override
+ public abstract int read()
+ throws IOException;
+
+ @Override
+ public void close()
+ throws IOException
+ {
+ }
+
+}
+
+
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONReader.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONStringReader.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONStringReader.java?rev=1603986&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONStringReader.java (added)
+++ manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONStringReader.java Thu Jun 19 18:13:58 2014
@@ -0,0 +1,123 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.core.jsongen;
+
+import java.io.*;
+
+/** This class describes a JSON string reader. */
+public class JSONStringReader extends JSONReader
+{
+ // Strings need to be escaped, therefore we have our own.
+ /*
+ All Unicode characters may be placed within the
+ quotation marks except for the characters that must be escaped:
+ quotation mark, reverse solidus, and the control characters (U+0000
+ through U+001F).
+
+ Any character may be escaped. If the character is in the Basic
+ Multilingual Plane (U+0000 through U+FFFF), then it may be
+ represented as a six-character sequence: a reverse solidus, followed
+ by the lowercase letter u, followed by four hexadecimal digits that
+ encode the character's code point. The hexadecimal letters A though
+ F can be upper or lowercase. So, for example, a string containing
+ only a single reverse solidus character may be represented as
+ "\u005C".
+
+ Alternatively, there are two-character sequence escape
+ representations of some popular characters. So, for example, a
+ string containing only a single reverse solidus character may be
+ represented more compactly as "\\".
+ */
+
+ protected final static int STATE_PREQUOTE = 0;
+ protected final static int STATE_U = 1;
+ protected final static int STATE_1ST = 2;
+ protected final static int STATE_2ND = 3;
+ protected final static int STATE_3RD = 4;
+ protected final static int STATE_4TH = 5;
+ protected final static int STATE_NEXTCHAR = 6;
+ protected final static int STATE_DONE = 7;
+
+ protected final Reader inputReader;
+
+ protected int state = STATE_PREQUOTE;
+ protected String escapedChar;
+
+ public JSONStringReader(String value)
+ {
+ inputReader = new StringReader(value);
+ }
+
+ public JSONStringReader(Reader value)
+ {
+ inputReader = value;
+ }
+
+ @Override
+ public int read()
+ throws IOException
+ {
+ int x;
+ switch (state)
+ {
+ case STATE_PREQUOTE:
+ state = STATE_NEXTCHAR;
+ return '"';
+ case STATE_NEXTCHAR:
+ x = inputReader.read();
+ if (x == -1)
+ {
+ state = STATE_DONE;
+ return '"';
+ }
+ else
+ {
+ if (x < ' ' || x == '"' || x == '\\')
+ {
+ escapedChar = "000" + Integer.toHexString(x);
+ escapedChar = escapedChar.substring(escapedChar.length()-4);
+ state = STATE_U;
+ return '\\';
+ }
+ return x;
+ }
+ case STATE_U:
+ state = STATE_1ST;
+ return 'u';
+ case STATE_1ST:
+ state = STATE_2ND;
+ return escapedChar.charAt(0);
+ case STATE_2ND:
+ state = STATE_3RD;
+ return escapedChar.charAt(1);
+ case STATE_3RD:
+ state = STATE_4TH;
+ return escapedChar.charAt(2);
+ case STATE_4TH:
+ state = STATE_NEXTCHAR;
+ return escapedChar.charAt(3);
+ case STATE_DONE:
+ return -1;
+ default:
+ throw new IllegalStateException("Unknown state: "+state);
+ }
+ }
+}
+
+
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONStringReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONStringReader.java
------------------------------------------------------------------------------
svn:keywords = Id
Added: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONValueReader.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONValueReader.java?rev=1603986&view=auto
==============================================================================
--- manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONValueReader.java (added)
+++ manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONValueReader.java Thu Jun 19 18:13:58 2014
@@ -0,0 +1,42 @@
+/* $Id$ */
+
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.manifoldcf.core.jsongen;
+
+import java.io.*;
+
+/** This class describes a JSON value reader, which can be any terminal value (e.g. string, integer, float). */
+public class JSONValueReader extends JSONReader
+{
+ /** Wrapped reader */
+ protected final Reader value;
+
+ protected JSONValueReader(Reader value)
+ {
+ this.value = value;
+ }
+
+ @Override
+ public int read()
+ throws IOException
+ {
+ return value.read();
+ }
+}
+
+
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONValueReader.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: manifoldcf/branches/CONNECTORS-954/framework/core/src/main/java/org/apache/manifoldcf/core/jsongen/JSONValueReader.java
------------------------------------------------------------------------------
svn:keywords = Id