Package org.apache.xindice.core.data

Examples of org.apache.xindice.core.data.Value


      public synchronized void setLoaded(boolean loaded) {
         this.loaded = loaded;
      }

      public synchronized void read() throws IOException {
         Value v = readValue(page);
         DataInputStream is = new DataInputStream(v.getInputStream());

         // Read in the Values
         values = new Value[ph.getValueCount()];
         for ( int i = 0; i < values.length; i++ ) {
            short valSize = is.readShort();
            byte[] b = new byte[valSize];

            is.read(b);
            values[i] = new Value(b);
         }

         // Read in the pointers
         ptrs = new long[ph.getPointerCount()];
         for ( int i = 0; i < ptrs.length; i++ )
View Full Code Here


         // Write out the pointers
         for ( int i = 0; i < ptrs.length; i++ )
            os.writeLong(ptrs[i]);

         writeValue(page, new Value(bos.toByteArray()));

         cache.put(new Long(page.getPageNum()), this);
      }
View Full Code Here

            return null;
      }

      public synchronized void getChildStream(int idx, Streamable stream) throws IOException {
         if ( ph.getStatus() == LEAF && idx >= 0 && idx < ptrs.length ) {
            Value v = readValue(ptrs[idx]);
            DataInputStream dis = new DataInputStream(v.getInputStream());
            stream.read(dis);
         }
      }
View Full Code Here

      public Value getSeparator(Value value1, Value value2) {
         int idx = value1.compareTo(value2);
         byte[] b = new byte[Math.abs(idx)];
         System.arraycopy(value2.getData(), 0, b, 0, b.length);
         return new Value(b);
      }
View Full Code Here

      public synchronized void split() throws IOException, BTreeException {
         Value[] leftVals;
         Value[] rightVals;
         long[] leftPtrs;
         long[] rightPtrs;
         Value separator;

         short vc = ph.getValueCount();
         int pivot = vc / 2;

         // Split the node into two nodes
View Full Code Here

         HashMap meta = new HashMap(1);
         meta.put(Record.MODIFIED, new Long(file.lastModified()));

         byte[] valueData = cache.getFile(file);
         if ( valueData != null )
            return new Record(key, new Value(valueData), meta);
      }
      catch ( Exception e ) {
         if (log.isDebugEnabled()) {
            log.debug("No message", e);
         }
View Full Code Here

                  ps = nk.name;

               IndexPattern pattern = new IndexPattern(symbols, ps, nsMap);

               XObject obj = (XObject)s;
               Value val1 = new Value(obj.str());

               IndexQuery iq = new IndexQuerySW(pattern, val1);
               return queryIndexes(nk, iq, ps, obj.getType());
            }
         }
View Full Code Here

         else
            break;
      }

      // Return a Value with the collected contents of all pages.
      return new Value(bos.toByteArray());
   }
View Full Code Here

                     b[0] = 0;
                  else
                     return EmptyValue;
                  break;
            }
            return new Value(b);
         }
         catch ( Exception e ) {
            return EmptyValue;
         }
      }

      if ( type == TRIMMED )
         value = QueryEngine.normalizeString(value);

      return new Value(value);
   }
View Full Code Here

      return new Value(value);
   }

   private Value getCombinedValue(Key key, int pos, int len, short elemID, short attrID) {
      Value result;
      try {
         int l = key.getLength();
         byte[] b = new byte[l+13];

         // Write the key
         System.arraycopy(key.getData(), 0, b, 0, l);
         b[l] = 0;

         // Write the pos
         b[l+1] = (byte)((pos >>> 24) & 0xFF);
         b[l+2] = (byte)((pos >>> 16) & 0xFF);
         b[l+3] = (byte)((pos >>> 8& 0xFF);
         b[l+4] = (byte)((pos >>> 0& 0xFF);

         // Write the len
         b[l+5] = (byte)((len >>> 24) & 0xFF);
         b[l+6] = (byte)((len >>> 16) & 0xFF);
         b[l+7] = (byte)((len >>> 8& 0xFF);
         b[l+8] = (byte)((len >>> 0& 0xFF);

         // Write the elemID
         b[l+9] = (byte)((elemID >>> 8& 0xFF);
         b[l+10] = (byte)((elemID >>> 0) & 0xFF);

         // Write the attrID
         b[l+11] = (byte)((attrID >>> 8) & 0xFF);
         b[l+12] = (byte)((attrID >>> 0) & 0xFF);

         result = new Value(b);
      }
      catch ( Exception e ) {
         result = null; // This will never happen
      }
      return result;
View Full Code Here

TOP

Related Classes of org.apache.xindice.core.data.Value

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.