You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2013/09/10 22:36:40 UTC
svn commit: r1521630 - in /incubator/vxquery/trunk/vxquery:
vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
vxquery-core/src/main/java/org/apache/vxquery/result/
vxquery-core/src/main/java/org/apache/vxquery/result/ResultUtils.java
Author: prestonc
Date: Tue Sep 10 20:36:39 2013
New Revision: 1521630
URL: http://svn.apache.org/r1521630
Log:
Moved class to follow the structure of AQL.
Added:
incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/result/
incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/result/ResultUtils.java (with props)
Modified:
incubator/vxquery/trunk/vxquery/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
Modified: incubator/vxquery/trunk/vxquery/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java?rev=1521630&r1=1521629&r2=1521630&view=diff
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java (original)
+++ incubator/vxquery/trunk/vxquery/vxquery-cli/src/main/java/org/apache/vxquery/cli/VXQuery.java Tue Sep 10 20:36:39 2013
@@ -33,6 +33,7 @@ import org.apache.vxquery.context.Dynami
import org.apache.vxquery.context.RootStaticContextImpl;
import org.apache.vxquery.context.StaticContextImpl;
import org.apache.vxquery.exceptions.SystemException;
+import org.apache.vxquery.result.ResultUtils;
import org.apache.vxquery.xmlquery.ast.ModuleNode;
import org.apache.vxquery.xmlquery.query.Module;
import org.apache.vxquery.xmlquery.query.XMLQueryCompiler;
@@ -315,30 +316,4 @@ public class VXQuery {
private List<String> arguments = new ArrayList<String>();
}
- public static class ResultUtils {
- public static String getStringFromBuffer(ByteBuffer buffer, IFrameTupleAccessor fta)
- throws HyracksDataException {
- String resultRecords = "";
- ByteBufferInputStream bbis = new ByteBufferInputStream();
- try {
- fta.reset(buffer);
- for (int tIndex = 0; tIndex < fta.getTupleCount(); tIndex++) {
- int start = fta.getTupleStartOffset(tIndex);
- int length = fta.getTupleEndOffset(tIndex) - start;
- bbis.setByteBuffer(buffer, start);
- byte[] recordBytes = new byte[length];
- bbis.read(recordBytes, 0, length);
- resultRecords += new String(recordBytes, 0, length);
- }
- } finally {
- try {
- bbis.close();
- } catch (IOException e) {
- throw new HyracksDataException(e);
- }
- }
- return resultRecords;
- }
- }
-
}
\ No newline at end of file
Added: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/result/ResultUtils.java
URL: http://svn.apache.org/viewvc/incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/result/ResultUtils.java?rev=1521630&view=auto
==============================================================================
--- incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/result/ResultUtils.java (added)
+++ incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/result/ResultUtils.java Tue Sep 10 20:36:39 2013
@@ -0,0 +1,47 @@
+/*
+ * 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.vxquery.result;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import edu.uci.ics.hyracks.api.comm.IFrameTupleAccessor;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.dataflow.common.comm.util.ByteBufferInputStream;
+
+public class ResultUtils {
+ public static String getStringFromBuffer(ByteBuffer buffer, IFrameTupleAccessor fta) throws HyracksDataException {
+ String resultRecords = "";
+ ByteBufferInputStream bbis = new ByteBufferInputStream();
+ try {
+ fta.reset(buffer);
+ for (int tIndex = 0; tIndex < fta.getTupleCount(); tIndex++) {
+ int start = fta.getTupleStartOffset(tIndex);
+ int length = fta.getTupleEndOffset(tIndex) - start;
+ bbis.setByteBuffer(buffer, start);
+ byte[] recordBytes = new byte[length];
+ bbis.read(recordBytes, 0, length);
+ resultRecords += new String(recordBytes, 0, length);
+ }
+ } finally {
+ try {
+ bbis.close();
+ } catch (IOException e) {
+ throw new HyracksDataException(e);
+ }
+ }
+ return resultRecords;
+ }
+}
Propchange: incubator/vxquery/trunk/vxquery/vxquery-core/src/main/java/org/apache/vxquery/result/ResultUtils.java
------------------------------------------------------------------------------
svn:eol-style = native