Class ContextWithChunk<ATTR extends Attributes.Any,CONTEXT extends Context>
java.lang.Object
com.illumon.iris.db.v2.sources.chunk.ContextWithChunk<ATTR,CONTEXT>
- All Implemented Interfaces:
- Context,- SafeCloseable,- AutoCloseable
- Direct Known Subclasses:
- DefaultGetContext
public class ContextWithChunk<ATTR extends Attributes.Any,CONTEXT extends Context> extends Object implements Context
- 
Method SummaryModifier and Type Method Description voidclose()Release any resources associated with this context.voidensureLength(int length)Makes sure that the internal array (and hence the writableChunk) is at least specified size.CONTEXTgetContext()static <CONTEXT extends Context>
 CONTEXTgetContext(Context context)ResettableChunk<ATTR>getResettableChunk()static <ATTR extends Attributes.Any, RESETTABLE_WRITABLE_CHUNK extends ResettableWritableChunk<ATTR>>
 RESETTABLE_WRITABLE_CHUNKgetResettableChunk(Context context)WritableChunk<ATTR>getWritableChunk()static <ATTR extends Attributes.Any, WRITABLE_CHUNK extends WritableChunk<ATTR>>
 WRITABLE_CHUNKgetWritableChunk(Context context)static <ATTR extends Attributes.Any>
 booleanisMyResettableChunk(Context context, Chunk<ATTR> chunk)Checks if this chunk is the result of a call togetResettableChunk()orgetResettableChunk(Context)with this context, followed by a some reset call, including the result of a call toresetChunkFromArray(Context, Object, int, int).static <ATTR extends Attributes.Any>
 booleanisMyWritableChunk(Context context, Chunk<ATTR> chunk)Checks if this chunk is the result of a call togetWritableChunk()orgetWritableChunk(Context)with this context.static <ATTR extends Attributes.Any, CHUNK extends Chunk<ATTR>>
 CHUNKresetChunkFromArray(Context context, Object array, int offset, int length)
- 
Method Details- 
closepublic void close()Description copied from interface:ContextRelease any resources associated with this context. The context should not be used afterwards.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Context
- Specified by:
- closein interface- SafeCloseable
 
- 
getWritableChunk- Returns:
- a WritableChunkwhich you can use for results
- ApiNote:
- the chunk is valid until the next call to this function, getResettableChunk(),getWritableChunk(Context),getResettableChunk(Context), orresetChunkFromArray(Context, Object, int, int)for this context.
 
- 
getResettableChunk- Returns:
- a ResettableChunkchunk which you can use for results by calling one of its various reset methods.
- ApiNote:
- the chunk is valid until the next call to this function, getWritableChunk(),getWritableChunk(Context),getResettableChunk(Context), orresetChunkFromArray(Context, Object, int, int)for this context.
 
- 
getContext- Returns:
- The context held in this Context
 
- 
getContext- Returns:
- The context held in this Context
 
- 
ensureLengthpublic void ensureLength(int length)Makes sure that the internal array (and hence the writableChunk) is at least specified size.
- 
getWritableChunkpublic static <ATTR extends Attributes.Any, WRITABLE_CHUNK extends WritableChunk<ATTR>> WRITABLE_CHUNK getWritableChunk(@NotNull Context context)- Parameters:
- context- The context that owns the reusable chunk
- Returns:
- a WritableChunkwhich you can use for results. The size will be set to 0.
- ApiNote:
- the chunk is valid until the next call to this function, getWritableChunk(),getResettableChunk(),getResettableChunk(Context), orresetChunkFromArray(Context, Object, int, int)for this context.
 
- 
getResettableChunkpublic static <ATTR extends Attributes.Any, RESETTABLE_WRITABLE_CHUNK extends ResettableWritableChunk<ATTR>> RESETTABLE_WRITABLE_CHUNK getResettableChunk(@NotNull Context context)- Parameters:
- context- The context that owns the reusable chunk
- Returns:
- a ResettableWritableChunk, which you can use for results by using one of its various reset methods.
- ApiNote:
- the chunk is valid until the next call to this function, getWritableChunk(),getResettableChunk(),getWritableChunk(Context),resetChunkFromArray(Context, Object, int, int)for this context.
 
- 
resetChunkFromArraypublic static <ATTR extends Attributes.Any, CHUNK extends Chunk<ATTR>> CHUNK resetChunkFromArray(@NotNull Context context, Object array, int offset, int length)- Parameters:
- context- The context that owns the reusable chunk
- array- The array to alias. If this is null, returns a null-value filled chunk.
- offset- The offset in the array for the beginning of the chunk
- length- The length of the chunk
- Returns:
- A chunk which aliases the region of the array which can be used for results.
- ApiNote:
- the chunk is valid until the next call to this function, getWritableChunk(),getResettableChunk(),getWritableChunk(Context), orgetResettableChunk(Context)for this context.
 
- 
isMyWritableChunkpublic static <ATTR extends Attributes.Any> boolean isMyWritableChunk(@NotNull Context context, Chunk<ATTR> chunk)Checks if this chunk is the result of a call togetWritableChunk()orgetWritableChunk(Context)with this context. This is primarily intended for testing and verification code.
- 
isMyResettableChunkpublic static <ATTR extends Attributes.Any> boolean isMyResettableChunk(@NotNull Context context, Chunk<ATTR> chunk)Checks if this chunk is the result of a call togetResettableChunk()orgetResettableChunk(Context)with this context, followed by a some reset call, including the result of a call toresetChunkFromArray(Context, Object, int, int). This is primarily intended for testing and verification code.
 
-