Examples of ByteArray


Examples of org.apache.derby.iapi.util.ByteArray

    {
      throw StandardException.newException(
                SQLState.DATA_UNEXPECTED_EXCEPTION, ioe);
    }

    return new ByteArray(array);
  }
View Full Code Here

Examples of org.apache.derby.iapi.util.ByteArray

                // column is long.

                if (!(column instanceof InputStream))
                {
                    // Convert already written object to an InputStream.
                    ByteArray fieldData =
                        new ByteArray(
                            ((DynamicByteArrayOutputStream)out).getByteArray(),
                            (columnBeginPosition), fieldDataLength);

                    ByteArrayInputStream columnIn =
                        new ByteArrayInputStream(
                            fieldData.getArray(), columnBeginPosition,
                            fieldDataLength);

                    MemByteHolder byteHolder =
                        new MemByteHolder(fieldDataLength + 1);
View Full Code Here

Examples of org.apache.derby.iapi.util.ByteArray

                // column is long.

        if (!(column instanceof InputStream))
                {
          // Convert already written object to an InputStream.
          ByteArray fieldData =
            new ByteArray(
                            ((DynamicByteArrayOutputStream)out).getByteArray(),
              (columnBeginPosition), fieldDataLength);

          ByteArrayInputStream columnIn =
            new ByteArrayInputStream(
                            fieldData.getArray(), columnBeginPosition,
                            fieldDataLength);

          MemByteHolder byteHolder =
                        new MemByteHolder(fieldDataLength + 1);
View Full Code Here

Examples of org.apache.hadoop.hdfs.util.ByteArray

  void cacheName(INode inode) {
    // Name is cached only for files
    if (inode.isDirectory() || inode.isLink()) {
      return;
    }
    ByteArray name = new ByteArray(inode.getLocalNameBytes());
    name = nameCache.put(name);
    if (name != null) {
      inode.setLocalName(name.getBytes());
    }
  }
View Full Code Here

Examples of org.apache.hadoop.io.file.tfile.ByteArray

      if (!isSorted()) {
        throw new IOException(
            "Cannot get key-bounded scanner for unsorted table");
      }
      RawComparable begin =
          (beginKey != null) ? new ByteArray(beginKey.get(), 0, beginKey
              .getSize()) : null;
      RawComparable end =
          (endKey != null) ? new ByteArray(endKey.get(), 0, endKey.getSize())
              : null;
      if (begin != null && end != null) {
        if (comparator.compare(begin, end) >= 0) {
          throw new IOException("Zero-key-range split");
        }
View Full Code Here

Examples of org.apache.hadoop.zebra.tfile.ByteArray

  /**
   * Get the block distribution of all data that maps to the key bucket.
   */
  public BlockDistribution getBlockDistribution(BytesWritable key) {
    ByteArray key0 = new ByteArray(key.get(), 0, key.getSize());
    BlockDistribution bInfo = data.get(key0);
    if (bInfo == null) {
      throw new IllegalArgumentException("Invalid key");
    }
    return bInfo;
View Full Code Here

Examples of org.apache.niolex.notify.ByteArray

     * Test method for {@link org.apache.niolex.notify.Notify#getProperty(org.apache.niolex.notify.ByteArray)}.
     */
    @Test
    public void testGetPropertyByteArray() {
        Notify notify = App.instance().getNotify("/notify/test/tmp");
        byte[] v = notify.getProperty(new ByteArray("love".getBytes()));
        assertEquals(new String(v), "lex");
    }
View Full Code Here

Examples of org.apache.uima.jcas.cas.ByteArray

      // create a Sofa and set the SofaArray feature to an int array FS.
      JCas shortArrayView = jcas.createView("shortArraySofaData");
      shortArrayView.setSofaDataArray(shortArrayFS, "shorts");

      // create a byte array fs
      ByteArray byteArrayFS = new ByteArray(jcas, 5);
      byteArrayFS.set(0, (byte) 8);
      byteArrayFS.set(1, (byte) 16);
      byteArrayFS.set(2, (byte) 64);
      byteArrayFS.set(3, (byte) 128);
      byteArrayFS.set(4, (byte) 255);
      // create a Sofa and set the SofaArray feature.
      JCas byteArrayView = jcas.createView("byteArraySofaData");
      byteArrayView.setSofaDataArray(byteArrayFS, "bytes");

      // create a long array fs
      LongArray longArrayFS = new LongArray(jcas, 5);
      longArrayFS.set(0, Long.MAX_VALUE);
      longArrayFS.set(1, Long.MAX_VALUE - 1);
      longArrayFS.set(2, Long.MAX_VALUE - 2);
      longArrayFS.set(3, Long.MAX_VALUE - 3);
      longArrayFS.set(4, Long.MAX_VALUE - 4);
      // create a Sofa and set the SofaArray feature.
      JCas longArrayView = jcas.createView("longArraySofaData");
      longArrayView.setSofaDataArray(longArrayFS, "longs");

      DoubleArray doubleArrayFS = new DoubleArray(jcas, 5);
      doubleArrayFS.set(0, Double.MAX_VALUE);
      doubleArrayFS.set(1, Double.MIN_VALUE);
      doubleArrayFS.set(2, Double.parseDouble("1.5555"));
      doubleArrayFS.set(3, Double.parseDouble("99.000000005"));
      doubleArrayFS.set(4, Double.parseDouble("4.44444444444444444"));
      // create a Sofa and set the SofaArray feature.
      JCas doubleArrayView = jcas.createView("doubleArraySofaData");
      doubleArrayView.setSofaDataArray(doubleArrayFS, "doubles");

      // create remote sofa and set the SofaURI feature
      JCas remoteView = jcas.createView("remoteSofaData");
      String sofaFileName = "./Sofa.xcas";
      remoteView.setSofaDataURI("file:" + sofaFileName, "text");
      PrintWriter out = new PrintWriter(sofaFileName);
      out.print("this beer is good");
      out.close();
     
      // read sofa data
      InputStream is = stringView.getSofaDataStream();
      assertTrue(is != null);
      byte[] dest = new byte[1];
      StringBuffer buf = new StringBuffer();
      while (is.read(dest) != -1) {
        buf.append((char) dest[0]);
      }
      assertTrue(buf.toString().equals("this beer is good"));

      dest = new byte[4];
      is.close();
      is = intArrayView.getSofaDataStream();
      assertTrue(is != null);
      BufferedInputStream bis = new BufferedInputStream(is);
      int i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).getInt() == intArrayFS.get(i++));
      }

      bis.close();
     
      is = floatArrayView.getSofaDataStream();
      assertTrue(is != null);
      bis = new BufferedInputStream(is);
      i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).getFloat() == floatArrayFS.get(i++));
      }

      dest = new byte[2];
      bis.close();
      is = shortArrayView.getSofaDataStream();
      assertTrue(is != null);
      bis = new BufferedInputStream(is);
      i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).getShort() == shortArrayFS.get(i++));
      }

      dest = new byte[1];
      bis.close();
      is = byteArrayView.getSofaDataStream();
      assertTrue(is != null);
      bis = new BufferedInputStream(is);
      i = 0;
      while (bis.read(dest) != -1) {
        assertTrue(ByteBuffer.wrap(dest).get() == byteArrayFS.get(i++));
      }

      dest = new byte[8];
      bis.close();
      is = longArrayView.getSofaDataStream();
View Full Code Here

Examples of org.codehaus.activemq.message.util.ByteArray

                            bas[i] = array[i].getBodyAsBytes();
                            if (i >= 1){
                                array[i].clearBody();
                            }
                        }
                        ByteArray ba = fragmentation.assemble(bas);
                        result.setBodyAsBytes(ba);
                    }
                    catch (IOException ioe) {
                        JMSException jmsEx = new JMSException("Failed to assemble fragment message: " + parentId);
                        jmsEx.setLinkedException(ioe);
View Full Code Here

Examples of org.elasticsearch.common.util.ByteArray

        // TODO: delegate to BigArrays via:
        // return bigarrays.equals(bytearray, other.bytearray);
        // and for slices:
        // return bigarrays.equals(bytearray, start, other.bytearray, otherstart, len);
        ByteArray otherArray = other.bytearray;
        int otherOffset = other.offset;
        for (int i = 0; i < length; i++) {
            if (bytearray.get(offset + i) != otherArray.get(otherOffset + i)) {
                return false;
            }
        }
        return true;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.