Namespace: OpenEdge.Core
Class
ByteBucket
Parent classes:
Progress.Lang.Object

Inherits: Progress.Lang.Object
Implements: OpenEdge.Core.ISupportInitialize

Copyright (c) 2014-2017 by Progress Software Corporation. All rights reserved.
File:ByteBucket
Purpose:An extensible bucket/container for byte-based data. The bucket
consists of temp-table with a RAW field
Author(s):pjudge
Created:Wed May 14 16:26:38 EDT 2014
Notes:* Bucket size is initially 3 x 30k records, and will expand
to contain whatever's passed in.
the bucket. The number of rows cannot shrink below the number
needed to contain the current data (ie :Size ).




Method Summary
Options Name Purpose
Clear () /** Clears/resets the ByteBucket. Does not de-allocate the memory, just the various pointers/counters/cursors. */
Debug () /* Debug method to dump out current RAW bytes into numbered files Files are named bytebucket-memptr-<number>.bin */
Destroy () /** Destroy/Shutdown/Anti-Initializer */
INTEGER GetByte () /** Returns a byte at the current position , and increments the position marker. @return integer The byte value at the current position */
INTEGER GetByte (int64) /** Returns a byte at the specified position, and increments the position marker. @param int64 The position at which to return the byte. @return integer The byte value at the current position */
OpenEdge.Core.Memptr GetBytes () /** Returns the entire contents of this bucket as a Memptr instance. @return Memptr The complete bucket data */
OpenEdge.Core.Memptr GetBytes (int64) /** Returns a Memptr instance containing the specified number of bytes, starting at the current Position. @param int64 The number of bytes to return @return Memptr The complete bucket data */
OpenEdge.Core.Memptr GetBytes (int64, int64) /** Returns a Memptr instance containing the specified number of bytes, starting at the specified postition. @param int64 The starting position @param int64 The number of bytes to return @return Memptr The complete bucket data */
RAW GetHash () /** Returns a hash of the current contents of the memptr. This can be used for comparing memptr values quickly. @return raw The hashed value of the memptr. */
RAW GetHash (HashAlgorithmEnum) /** Returns a hash of the current contents of the memptr. This can be used for comparing memptr values quickly. @param HashAlgorithmEnum The algorithm to use for the message @return raw The hashed value of the memptr. */
LONGCHAR GetString () /** Returns a string/character representation of the entire set of bytes. @return longchar The character/string data requested */
LONGCHAR GetString (int64) /** Returns a string/character representation a particular number of bytes, from the current Position. @param int64 The size of the data (in bytes) to return @return longchar The character/string data requested */
LONGCHAR GetString (int64, int64) /** Returns a string/character representation a particular number of bytes, from a given start position. @param int64 The start potision @param int64 The size of the data (in bytes) to return @return longchar The character/string data requested */
LONGCHAR GetString (int64, int64, character) /** Returns a string/character representation a particular number of bytes, from a given start position. @param int64 The start potision @param int64 The size of the data (in bytes) to return @param character The target codepage for the character data @return longchar The character/string data requested */
LONGCHAR GetString (int64, int64, character, character) /** Returns a string/character representation a particular number of bytes, from a given start position. @param int64 The start potision @param int64 The size of the data (in bytes) to return @param character The source codepage for the character data @param character The target codepage for the character data @return longchar The character/string data requested */
Initialize () /** Default object initialization Clears and resizes the bucket's internals to the initial size (num records) */
OpenEdge.Core.ByteBucket Instance () /** Factory method for creating a ByteBucket. */
OpenEdge.Core.ByteBucket Instance (int64) /** Factory method for creating a ByteBucket. @param int64 The size of each memptr in the array */
OpenEdge.Core.ByteBucket Instance (integer, int64) /** Factory method for creating a ByteBucket. @param integer The initial size of the array (ie how many extents) @param int64 The size of each memptr in the array */
MergeBuckets (ByteBucket, ByteBucket) /** Merges the contents of 2 ByteBuckets @param ByteBucket The source bucket (ie where we are copying FROM ) @param ByteBucket The target bucket (ie where we are copying TO) */
PutBytes (ByteBucket) /** Copies all of the bytes from a ByteBucket instance into this bucket. The caller is responsible for cleaning up the source ByteBucket. @param ByteBucket The ByteBucket instance containing the data. */
PutBytes (int64, int64) /** Copies all of the bytes from a memptr into this bucket. The caller is responsible for cleaning up the memptr. @param int64 The pointer to memory represented by a memptr (via get-pointer-value). @param int64 The size of the memptr represented by the pointer value. */
PutBytes (Memptr) /** Copies all of the bytes from a Memptr instance into this bucket. The caller is responsible for cleaning up the memptr. @param OpenEdge.Core.Memptr The Memptr instance containing the data. */
PutBytes (memptr) /** Copies all of the bytes from a memptr (primitive) into this bucket. The caller is responsible for cleaning up the memptr. @param memptr The memptr containing the data. */
PutString (longchar) /** Copies all of the bytes from a longchar into this bucket. @param longchar The longchar containing the source data */
PutString (longchar, longchar) /** Copies all of the bytes from a longchar into this bucket. @param longchar The longchar containing the source data @param character The target codepage used to write data into the bucket. Defaults to UTF-8 */
PutString (String) /** Copies all of the bytes from a String object (longchar) into this bucket. @param String The longchar containing the source data. */
ReadBytes (int64, memptr) /* Reads data from the internal TT records into a memptr for return by GetBytes() and GetString() and friends. - The caller is responsible for cleaning up the memptr. - The memptr size is also the number of bytes to read @param int64 The start position to read @param memptr The memptr into which to read the data */
Resize (integer) /** Resizes the internal 'array' of records. We can shrink down the number of rows, but not smaller than the bucket's size in bytes. @param integer The new size (number of records) for the internal structure */
ResizeArray (integer) /** Resizes the internal 'array' of records. We can shrink down the number of rows, but not smaller than the bucket's size. @param integer The new size (number of extents) for the array */
WriteBytes (int64, int64) /** Writes the contents/bytes of the currently-read memptr (mmTempBytes) into this bucket. This method writes bytes until the current bucket is full, then resizes the bucket appropriately and calls itself. @param int64 The start position in the memptr. @param int64 The number of bytes to write */

Constructor Summary
Options Name Purpose
ByteBucket () /** Constructor for a ByteBucket. Defaults to 2 memptrs of 16k each */
ByteBucket (int64)
ByteBucket (integer) /** Constructor for a ByteBucket @param integer The initial size of the bucket (ie how many 32k rows) */
ByteBucket (integer, int64)

Property Summary
Options Name Purpose
INT64 DefaultCapacity /** The initial size of the memptrs that are held in the Bucket's array. Each memptr is the same size */
INTEGER MAX_BYTES_PER_ROW
INT64 Position /** The current read position */
INT64 Size /** Returns the size of the data in the bucket */


Method Detail
Top

Clear ()

Purpose: Clears/resets the ByteBucket. Does not de-allocate the memory, just the
various pointers/counters/cursors.
Top

Debug ()

/* Debug method to dump out current RAW bytes into numbered files
Files are named bytebucket-memptr-<number>.bin
Top

Destroy ()

Purpose: Destroy/Shutdown/Anti-Initializer
Top

INTEGER GetByte ()

Purpose: Returns a byte at the current position , and increments the
position marker.
Returns INTEGER
integer The byte value at the current position
Top

INTEGER GetByte (int64)

Purpose: Returns a byte at the specified position, and increments the
position marker.
Parameters:
piStartPos INT64
Returns INTEGER
integer The byte value at the current position
Top

OpenEdge.Core.Memptr GetBytes ()

Purpose: Returns the entire contents of this bucket as a Memptr instance.
Returns OpenEdge.Core.Memptr
Memptr The complete bucket data
Top

OpenEdge.Core.Memptr GetBytes (int64)

Purpose: Returns a Memptr instance containing the specified number of bytes,
starting at the current Position.
Parameters:
piSliceSize INT64
Returns OpenEdge.Core.Memptr
Memptr The complete bucket data
Top

OpenEdge.Core.Memptr GetBytes (int64, int64)

Purpose: Returns a Memptr instance containing the specified number of bytes,
starting at the specified postition.
Parameters:
piStartPos INT64
piSliceSize INT64
Returns OpenEdge.Core.Memptr
Memptr The complete bucket data
Top

RAW GetHash ()

Purpose: Returns a hash of the current contents of the memptr. This can be used
for comparing memptr values quickly.
Returns RAW
raw The hashed value of the memptr.
Top

RAW GetHash (HashAlgorithmEnum)

Purpose: Returns a hash of the current contents of the memptr. This can be used
for comparing memptr values quickly.
Parameters:
poAlgorithm OpenEdge.Core.HashAlgorithmEnum
Returns RAW
raw The hashed value of the memptr.
Top

LONGCHAR GetString ()

Purpose: Returns a string/character representation of the entire set of bytes.
Returns LONGCHAR
longchar The character/string data requested
Top

LONGCHAR GetString (int64)

Purpose: Returns a string/character representation a particular number of bytes,
from the current Position.
Parameters:
piSliceSize INT64
Returns LONGCHAR
longchar The character/string data requested
Top

LONGCHAR GetString (int64, int64)

Purpose: Returns a string/character representation a particular number of bytes,
from a given start position.
Parameters:
piStartPos INT64
piSliceSize INT64
Returns LONGCHAR
longchar The character/string data requested
Top

LONGCHAR GetString (int64, int64, character)

Purpose: Returns a string/character representation a particular number of bytes,
from a given start position.
Parameters:
piStartPos INT64
piSliceSize INT64
pcTargetCodepage CHARACTER
Returns LONGCHAR
longchar The character/string data requested
Top

LONGCHAR GetString (int64, int64, character, character)

Purpose: Returns a string/character representation a particular number of bytes,
from a given start position.
Parameters:
piStartPos INT64
piSliceSize INT64
pcSourceCodepage CHARACTER
pcTargetCodepage CHARACTER
Returns LONGCHAR
longchar The character/string data requested
Top

Initialize ()

Purpose: Default object initialization
Clears and resizes the bucket's internals to the initial size (num records)
Top

OpenEdge.Core.ByteBucket Instance ()

Purpose: Factory method for creating a ByteBucket.
Returns OpenEdge.Core.ByteBucket
Top

OpenEdge.Core.ByteBucket Instance (int64)

Purpose: Factory method for creating a ByteBucket.
Parameters:
piDefaultCapacity INT64
Returns OpenEdge.Core.ByteBucket
Top

OpenEdge.Core.ByteBucket Instance (integer, int64)

Purpose: Factory method for creating a ByteBucket.
Parameters:
piInitialSize INTEGER
piDefaultCapacity INT64
Returns OpenEdge.Core.ByteBucket
Top

MergeBuckets (ByteBucket, ByteBucket)

Purpose: Merges the contents of 2 ByteBuckets
Parameters:
poSource OpenEdge.Core.ByteBucket
poTarget OpenEdge.Core.ByteBucket
Top

PutBytes (ByteBucket)

Purpose: Copies all of the bytes from a ByteBucket instance into this bucket. The
caller is responsible for cleaning up the source ByteBucket.
Parameters:
poData OpenEdge.Core.ByteBucket
Top

PutBytes (int64, int64)

Purpose: Copies all of the bytes from a memptr into this bucket. The
caller is responsible for cleaning up the memptr.
Parameters:
piPointerValue INT64
piSize INT64
Top

PutBytes (Memptr)

Purpose: Copies all of the bytes from a Memptr instance into this bucket. The
caller is responsible for cleaning up the memptr.
Parameters:
poData OpenEdge.Core.Memptr
Top

PutBytes (memptr)

Purpose: Copies all of the bytes from a memptr (primitive) into this bucket. The
caller is responsible for cleaning up the memptr.
Parameters:
pmData OpenEdge.Core.Memptr
Top

PutString (longchar)

Purpose: Copies all of the bytes from a longchar into this bucket.
Parameters:
pcData LONGCHAR
Top

PutString (longchar, longchar)

Purpose: Copies all of the bytes from a longchar into this bucket.
Parameters:
pcData LONGCHAR
pcTargetCodepage LONGCHAR
Top

PutString (String)

Purpose: Copies all of the bytes from a String object (longchar) into this bucket.
Parameters:
poData OpenEdge.Core.String
Top

ReadBytes (int64, memptr)

/* Reads data from the internal TT records into a memptr
for return by GetBytes() and GetString() and friends.
- The caller is responsible for cleaning up the memptr.
- The memptr size is also the number of bytes to read
Parameters:
piStartPos INT64
pData OpenEdge.Core.Memptr
Top

Resize (integer)

Purpose: Resizes the internal 'array' of records.
We can shrink down the number of rows, but not smaller than the
bucket's size in bytes.
Parameters:
piSize INTEGER
Top

ResizeArray (integer)

Purpose: Resizes the internal 'array' of records.
We can shrink down the number of rows, but not smaller than the
bucket's size.
Parameters:
piSize INTEGER
Top

WriteBytes (int64, int64)

Purpose: Writes the contents/bytes of the currently-read memptr (mmTempBytes)
into this bucket. This method writes bytes until the current bucket is
full, then resizes the bucket appropriately and calls itself.
Parameters:
piStartPos INT64
piBytesLeft INT64


Constructor Detail
Top

ByteBucket ()

Purpose: Constructor for a ByteBucket. Defaults to 2 memptrs of 16k each
Top

ByteBucket (int64)

Parameters:
piDefaultCapacity INT64
Top

ByteBucket (integer)

Purpose: Constructor for a ByteBucket
Parameters:
piInitialSize INTEGER
Top

ByteBucket (integer, int64)

Parameters:
piInitialSize INTEGER
piDefaultCapacity INT64


Property Detail
Top

INT64 DefaultCapacity

Purpose: The initial size of the memptrs that are held in the Bucket's array.
Each memptr is the same size
Returns INT64
Top

INTEGER MAX_BYTES_PER_ROW

Returns INTEGER
Top

INT64 Position

Purpose: The current read position
Returns INT64
Top

INT64 Size

Purpose: Returns the size of the data in the bucket
Returns INT64


Copyright © 2017 Progress Software Corporation. All rights Reserved.

Progress® OpenEdge® Release 11.7