Examples of ByteBuilder


Examples of org.voltdb.benchmark.tpcc.procedures.ByteBuilder

            int newLength = newData.length + c_data.length;
            if (newLength > TPCCConstants.MAX_C_DATA) {
                newLength = TPCCConstants.MAX_C_DATA;
            }
            ByteBuilder builder = new ByteBuilder(newLength);

            int minLength = newLength;
            if (newData.length < minLength) minLength = newData.length;
            builder.append(newData, 0, minLength);

            int remaining = newLength - minLength;
            builder.append(c_data, 0, remaining);
            c_data = builder.array();
            voltQueueSQL(updateBCCustomer, c_balance, c_ytd_payment, c_payment_cnt, c_data, W_ID, D_ID, c_id);
        }
        else{
            c_data = new byte[0];
            voltQueueSQL(updateGCCustomer, c_balance, c_ytd_payment, c_payment_cnt, W_ID, D_ID, c_id);
        }

        // Concatenate w_name, four spaces, d_name
        byte[] w_name = warehouse.fetchRow(0).getStringAsBytes(W_NAME_IDX);
        final byte[] FOUR_SPACES = { ' ', ' ', ' ', ' ' };
        byte[] d_name = district.fetchRow(0).getStringAsBytes(D_NAME_IDX);
        ByteBuilder builder = new ByteBuilder(w_name.length + FOUR_SPACES.length + d_name.length);
        builder.append(w_name);
        builder.append(FOUR_SPACES);
        builder.append(d_name);
        byte[] h_data = builder.array();

        // Create the history record
        voltQueueSQL(insertHistory, c_id, D_ID, W_ID, D_ID, W_ID, timestamp, paymentAmount, h_data);
        voltExecuteSQL();
View Full Code Here

Examples of org.voltdb.benchmark.tpcc.procedures.ByteBuilder

            int newLength = newData.length + c_data.length;
            if (newLength > Constants.MAX_C_DATA) {
                newLength = Constants.MAX_C_DATA;
            }
            ByteBuilder builder = new ByteBuilder(newLength);

            int minLength = newLength;
            if (newData.length < minLength) minLength = newData.length;
            builder.append(newData, 0, minLength);

            int remaining = newLength - minLength;
            builder.append(c_data, 0, remaining);
            c_data = builder.array();
            voltQueueSQL(updateBCCustomer, c_balance, c_ytd_payment, c_payment_cnt, c_data, W_ID, D_ID, c_id);
        }
        else{
            c_data = new byte[0];
            voltQueueSQL(updateGCCustomer, c_balance, c_ytd_payment, c_payment_cnt, W_ID, D_ID, c_id);
        }

        // Concatenate w_name, four spaces, d_name
        byte[] w_name = warehouse.fetchRow(0).getStringAsBytes(W_NAME_IDX);
        final byte[] FOUR_SPACES = { ' ', ' ', ' ', ' ' };
        byte[] d_name = district.fetchRow(0).getStringAsBytes(D_NAME_IDX);
        ByteBuilder builder = new ByteBuilder(w_name.length + FOUR_SPACES.length + d_name.length);
        builder.append(w_name);
        builder.append(FOUR_SPACES);
        builder.append(d_name);
        byte[] h_data = builder.array();

        // Create the history record
        voltQueueSQL(insertHistory, c_id, D_ID, W_ID, D_ID, W_ID, timestamp, paymentAmount, h_data);
        voltExecuteSQL();
View Full Code Here

Examples of util.ByteBuilder

    mbaHeader=new Property("IDAT");
   
    byte[] output = new byte[1024]; //buffer to read from Deflater
   

    ByteBuilder deflated=new ByteBuilder(); //complete deflate-stream
   
    Deflater compresser = new Deflater(Deflater.DEFAULT_COMPRESSION); //deflater-obj
   
    compresser.setInput(imagedata);
    compresser.finish(); //indicate: there is no more input
   
    int compressedDataLength=0;
   
   
    while( compresser.finished()==false ){ //reading loop
      int tmpComprLength = compresser.deflate(output);
     
      //if stop-button is clicked
      if(Thread.currentThread().isInterrupted()){
        return;
      }
     
      deflated.appendArray(
          (tmpComprLength==output.length)
          ?output
          :Arrays.copyOf(output, tmpComprLength));
      //append new data to existing data
     
      compressedDataLength+=tmpComprLength; //total read bytes so far
   
    }
    assert(compresser.getBytesWritten()==compressedDataLength);
   
    mbaDeflatedStream=deflated.getArray();

  }
View Full Code Here

Examples of util.ByteBuilder

    }
  }

  @Override
  protected byte[] getData() {
    ByteBuilder bb = new ByteBuilder();
    bb.append(miNumFrames);
    bb.append(miNumLoops);
    
    return bb.getArray();
  }
View Full Code Here

Examples of util.ByteBuilder

  }
 
  @Override
  protected byte[] getData()
  {
    ByteBuilder bb = new ByteBuilder();
    bb.appendArray(mKeyword.getBytes());
    bb.appendSingle(0);
    bb.appendArray(mText.getBytes());
    return bb.getArray();
  }
View Full Code Here

Examples of util.ByteBuilder

    mbBlendOp=(byte)iblendmethod; 
  }

  @Override
  protected byte[] getData() {
    ByteBuilder bb = new ByteBuilder();
    bb.append(miSequenceNumber);
    bb.append(miWidth);
    bb.append(miHeight);
    bb.append(miX_Offset);
    bb.append(miY_Offset);
    bb.append(msDelayNum);
    bb.append(msDelayDen);
    bb.appendSingle(mbDisposeOp);
    bb.appendSingle(mbBlendOp);
    return bb.getArray();
   
  }
View Full Code Here

Examples of util.ByteBuilder

    mbaHeader=new Property("IDAT");
   
    byte[] output = new byte[1024]; //buffer to read from Deflater
   

    ByteBuilder deflated=new ByteBuilder(); //complete deflate-stream
   
    Deflater compresser = new Deflater(Deflater.DEFAULT_COMPRESSION); //deflater-obj
   
    compresser.setInput(imagedata);
    compresser.finish(); //indicate: there is no more input
   
    int compressedDataLength=0;
   
   
    while( compresser.finished()==false ){ //reading loop
      int tmpComprLength = compresser.deflate(output);
     
      //if stop-button is clicked
      if(Thread.currentThread().isInterrupted()){
        return;
      }
     
      deflated.appendArray(
          (tmpComprLength==output.length)
          ?output
          :Arrays.copyOf(output, tmpComprLength));
      //append new data to existing data
     
      compressedDataLength+=tmpComprLength; //total read bytes so far
   
    }
    assert(compresser.getBytesWritten()==compressedDataLength);
   
    mbaDeflatedStream=deflated.getArray();

  }
View Full Code Here

Examples of util.ByteBuilder

    }
  }

  @Override
  protected byte[] getData() {
    ByteBuilder bb = new ByteBuilder();
    bb.append(miNumFrames);
    bb.append(miNumLoops);
    
    return bb.getArray();
  }
View Full Code Here

Examples of util.ByteBuilder

    mbaHeader=new Property("IDAT");
   
    byte[] output = new byte[1024]; //buffer to read from Deflater
   

    ByteBuilder deflated=new ByteBuilder(); //complete deflate-stream
   
    Deflater compresser = new Deflater(Deflater.DEFAULT_COMPRESSION); //deflater-obj
   
    compresser.setInput(imagedata);
    compresser.finish(); //indicate: there is no more input
   
    int compressedDataLength=0;
   
   
    while( compresser.finished()==false ){ //reading loop
      int tmpComprLength = compresser.deflate(output);
     
      //if stop-button is clicked
      if(Thread.currentThread().isInterrupted()){
        return;
      }
     
      deflated.appendArray(
          (tmpComprLength==output.length)
          ?output
          :Arrays.copyOf(output, tmpComprLength));
      //append new data to existing data
     
      compressedDataLength+=tmpComprLength; //total read bytes so far
   
    }
    assert(compresser.getBytesWritten()==compressedDataLength);
   
    mbaDeflatedStream=deflated.getArray();

  }
View Full Code Here

Examples of util.ByteBuilder

    mbBlendOp=(byte)iblendmethod; 
  }

  @Override
  protected byte[] getData() {
    ByteBuilder bb = new ByteBuilder();
    bb.append(miSequenceNumber);
    bb.append(miWidth);
    bb.append(miHeight);
    bb.append(miX_Offset);
    bb.append(miY_Offset);
    bb.append(msDelayNum);
    bb.append(msDelayDen);
    bb.appendSingle(mbDisposeOp);
    bb.appendSingle(mbBlendOp);
    return bb.getArray();
   
  }
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.