ComposantsComponents

ComposantsComponents › DiversMisc

tBufferInput

tBufferInput

DiversMisc

Relit les lignes que les tBufferOutput du même job ont mises dans son tampon, et les envoie dans un flux. Il lit tout le tampon, dans l'ordre où les lignes y sont entrées, et le laisse intact : un autre tBufferInput peut le relire. Les valeurs, gardées sous forme de texte, sont converties dans les types de son schéma, par position. Reads the rows that the tBufferOutput components of the same job put in its buffer, and sends them into a flow. It reads the whole buffer, in the order the rows came in, and leaves it unchanged: another tBufferInput can read it again. The values, kept as text, are converted to the types of its schema, by position.

EntréeInput

Aucune : il commence son sous-job.None: it starts its subjob.

SortieOutput

Main un flux : les lignes du tamponone flow: the rows of the buffer

Déclencheurs en sortieOutput triggers

On Subjob Ok On Subjob Error On Component Ok On Component Error Run if

UtilisationUsage

Après le tBufferOutputAfter the tBufferOutput

row1 (Main) OnSubjobOk row2 (Main) tFileInputDelimited_1 tBufferOutput_1 tBufferInput_1 tMap_1

Le tBufferInput commence un sous-job qui s'exécute une fois le tampon rempli : la source n'est lue qu'une fois, ses lignes servent ensuite où il faut. The tBufferInput starts a subjob that runs once the buffer is filled: the source is read only once, its rows are then used where needed.

Rassembler plusieurs sourcesGather several sources

row1 (Main) OnSubjobOk row2 (Main) OnSubjobOk row3 (Main) tFileInputDelimited_1 tBufferOutput_1 tDBInput_1 tBufferOutput_2 tBufferInput_1 tMap_1

Les deux tBufferOutput remplissent le même tampon : le tBufferInput lit les lignes des deux sources, à la suite, avec le même schéma. Both tBufferOutput components fill the same buffer: the tBufferInput reads the rows of both sources, one after the other, with the same schema.

  1. Déposez le tBufferInput depuis la famille Divers de la palette, à part : il commence un nouveau sous-job. Drop the tBufferInput from the Misc family of the palette, on its own: it starts a new subjob.
  2. Donnez-lui un schéma : les colonnes du tBufferOutput, dans le même ordre. Il ne le reçoit pas tout seul. Les noms peuvent changer, pas l'ordre ; un type peut changer s'il accepte le texte gardé (voir Conversion des valeurs). Give it a schema: the columns of the tBufferOutput, in the same order. It does not get it by itself. The names may change, not the order; a type may change if it accepts the kept text (see Value conversion).
  3. Reliez le sous-job du tBufferOutput à celui du tBufferInput par On Subjob Ok : le tampon doit être rempli avant d'être lu. Connect the subjob of the tBufferOutput to the one of the tBufferInput with On Subjob Ok: the buffer must be filled before it is read.
  4. Reliez sa sortie Main au composant suivant. Connect its Main output to the next component.

Paramètres simplesBasic settings

Les libellés sont ceux de l'onglet Composant ; le nom technique, en gris, est celui du paramètre dans le fichier du job. Labels are those of the Component tab; the technical name, in grey, is the parameter name in the job file.

ParamètreSetting DéfautDefault VisibleShown Description
SchémaSchemaSCHEMA videempty ToujoursAlways Les colonnes lues. La 1re colonne reçoit la 1re valeur de chaque ligne du tampon, et ainsi de suite ; les noms ne comptent pas. Une colonne au-delà des valeurs de la ligne reçoit null ; les valeurs en trop sont ignorées (voir les exemples). The columns read. The 1st column receives the 1st value of each buffer row, and so on; the names do not matter. A column beyond the values of the row receives null; the extra values are ignored (see the examples).

Paramètres avancésAdvanced settings

ParamètreSetting DéfautDefault VisibleShown Description
Séparateur avancé (pour les nombres)Advanced separator (for numbers)ADVANCED_SEPARATOR NonNo ToujoursAlways Pour les colonnes numériques : retire le séparateur de milliers du texte et remplace le séparateur décimal par un point, avant la conversion. Utile quand le tampon contient des montants écrits en texte, comme 1.234,50 ; un nombre rangé depuis une colonne numérique est déjà écrit 1234.5. Voir l'exemple. For number columns: removes the thousands separator from the text and replaces the decimal separator with a dot, before the conversion. Useful when the buffer holds amounts written as text, such as 1.234,50; a number stored from a number column is already written 1234.5. See the example.
Séparateur de milliersThousands separatorTHOUSANDS_SEPARATOR "," Séparateur avancé cochéAdvanced separator checked Le caractère retiré du texte. The character removed from the text.
Séparateur décimalDecimal separatorDECIMAL_SEPARATOR "." Séparateur avancé cochéAdvanced separator checked Le caractère remplacé par un point. The character replaced with a dot.
EncodageEncodingENCODING "ISO-8859-15" ToujoursAlways Ne sert qu'aux colonnes byte[] : le texte du tampon est reconverti en octets avec cet encodage. Le tBufferOutput a écrit ce texte avec l'encodage par défaut de la machine Java (UTF-8 depuis Java 18) : avec le défaut, un octet non ASCII ne revient pas tel quel. Voir l'exemple. Only used for byte[] columns: the buffer text is converted back to bytes with this encoding. The tBufferOutput wrote this text with the default encoding of the Java machine (UTF-8 since Java 18): with the default, a non-ASCII byte does not come back as it was. See the example.

Conversion des valeurs et variable globaleValue conversion and global variable

Du texte au type de la colonneFrom text to the column type

Le tampon ne contient que du texte (voir le tBufferOutput). Chaque valeur est convertie selon le type de sa colonne : The buffer only holds text (see the tBufferOutput). Each value is converted according to the type of its column:

  • String, Object : le texte tel quel.String, Object: the text as it is.
  • Integer, Long, Double, BigDecimal… : lu comme un nombre Java (1234.5). Un texte qui n'en est pas un arrête le job.Integer, Long, Double, BigDecimal…: read as a Java number (1234.5). A text that is not one stops the job.
  • Boolean : vrai pour true ou 1, faux pour le reste.Boolean: true for true or 1, false for anything else.
  • Date : lue avec le modèle de date de la colonne, qui doit être celui du tBufferOutput.Date: read with the date pattern of the column, which must be the one of the tBufferOutput.
  • byte[] : le texte reconverti en octets avec l'Encodage.byte[]: the text converted back to bytes with the Encoding.
  • Une valeur null reste null.A null value stays null.

Variable globaleGlobal variable

NB_LINE (Integer, disponible après l'exécution du composant) : nombre de lignes lues, 0 pour un tampon vide. NB_LINE (Integer, available after the component has run): number of rows read, 0 for an empty buffer.

((Integer) globalMap.get("tBufferInput_1_NB_LINE"))

ExemplesExamples

Les sorties sont celles de la console, copiées depuis une exécution du job. Les tLogRow sont en mode Simple ; certains affichent leur nom unique. The outputs are the console ones, copied from a run of the job. The tLogRow components are in Basic mode; some print their unique name.

Écrire puis relireWrite then read

row1 (Main) OnSubjobOk row2 (Main) OnSubjobOk tFixedFlowInput_1 tBufferOutput_1 tBufferInput_1 tLogRow_1 tJava_1
idInteger nameString
1Ada
2Grace
3Alan

Le tBufferInput_1 a le même schéma que le tBufferOutput_1. Code du tJava_1 : tBufferInput_1 has the same schema as tBufferOutput_1. tJava_1 code:

System.out.println("tBufferInput_1_NB_LINE: " + globalMap.get("tBufferInput_1_NB_LINE"));
1|Ada
2|Grace
3|Alan
tBufferInput_1_NB_LINE: 3

Lire deux foisRead twice

row1 (Main) OnSubjobOk row2 (Main) OnSubjobOk row3 (Main) tFixedFlowInput_1 tBufferOutput_1 tBufferInput_1 tLogRow_1 tBufferInput_2 tLogRow_2

Deux lignes (1 Ada, 2 Grace), les deux tBufferInput ont le même schéma. Two rows (1 Ada, 2 Grace), both tBufferInput components have the same schema.

[tLogRow_1] 1|Ada
[tLogRow_1] 2|Grace
[tLogRow_2] 1|Ada
[tLogRow_2] 2|Grace

La lecture ne vide pas le tampon : le tBufferInput_2 relit les mêmes lignes. Reading does not empty the buffer: tBufferInput_2 reads the same rows again.

Lire avant d'écrireRead before writing

row1 (Main) OnSubjobOk row2 (Main) OnSubjobOk tBufferInput_1 tLogRow_1 tFixedFlowInput_1 tBufferOutput_1 tJava_1

Les composants du premier exemple, avec deux lignes, et les sous-jobs dans l'ordre inverse : le tBufferInput_1 s'exécute d'abord. Même tJava_1. The components of the first example, with two rows, and the subjobs in reverse order: tBufferInput_1 runs first. Same tJava_1.

tBufferInput_1_NB_LINE: 0

Aucune erreur, contrairement au tHashInput : le tBufferInput lit un tampon encore vide, n'envoie aucune ligne, et le job continue. No error, unlike the tHashInput: the tBufferInput reads a buffer that is still empty, sends no row, and the job goes on.

Moins de colonnes que de valeursFewer columns than values

row1 (Main) OnSubjobOk row2 (Main) tFixedFlowInput_1 tBufferOutput_1 tBufferInput_1 tLogRow_1

Le tBufferOutput_1 garde une ligne de trois colonnes, id (Integer), name, city : 1, Ada, London. Le tBufferInput_1 n'a qu'une colonne, id (Integer). tBufferOutput_1 keeps one row of three columns, id (Integer), name, city: 1, Ada, London. tBufferInput_1 only has one column, id (Integer).

1

Les valeurs en trop sont ignorées. Dans l'autre sens, une colonne sans valeur reçoit null : voir l'exemple à deux tBufferOutput. The extra values are ignored. The other way round, a column without a value receives null: see the example with two tBufferOutput.

Dans un job enfantIn a child job

MyJob

row1 (Main) OnSubjobOk tFixedFlowInput_1 tBufferOutput_1 tRunJob_1

ChildJob

row1 (Main) OnSubjobOk tBufferInput_1 tLogRow_1 tJava_1

Le job parent remplit son tampon (1 Ada, 2 Grace), puis lance le job enfant. Le tJava_1 du job enfant affiche "Child job: tBufferInput_1_NB_LINE: " suivi du NB_LINE. Les noms des jobs sont remplacés par MyJob et ChildJob. The parent job fills its buffer (1 Ada, 2 Grace), then runs the child job. tJava_1 of the child job prints "Child job: tBufferInput_1_NB_LINE: " followed by the NB_LINE. The job names are replaced with MyJob and ChildJob.

Child job: tBufferInput_1_NB_LINE: 0

Chaque job a son propre tampon : le job enfant ne voit pas celui du parent. Dans l'autre sens, les lignes du job enfant reviennent au parent par la sortie du tRunJob (exemple). Each job has its own buffer: the child job does not see the one of the parent. The other way round, the rows of the child job come back to the parent through the output of the tRunJob (example).

Séparateur avancéAdvanced separator

row1 (Main) OnSubjobOk row2 (Main) OnSubjobOk row3 (Main) tFixedFlowInput_1 tBufferOutput_1 tBufferInput_1 tLogRow_1 tBufferInput_2 tLogRow_2

Le tBufferOutput_1 garde une colonne amount de type String : "1.234,50". Les deux tBufferInput lisent amount en Double. tBufferInput_1 : Séparateur avancé coché, milliers ".", décimal ",". tBufferInput_2 : réglages par défaut. Le nom du job est remplacé par MyJob, la trace est abrégée. tBufferOutput_1 keeps an amount column of type String: "1.234,50". Both tBufferInput components read amount as Double. tBufferInput_1: Advanced separator checked, thousands ".", decimal ",". tBufferInput_2: default settings. The job name is replaced with MyJob, the trace is shortened.

[tLogRow_1] 1234.5
Exception in component tBufferInput_2 (MyJob)
java.lang.NumberFormatException: For input string: "1.234,50"
	at …

Encodage, colonne byte[]Encoding, byte[] column

row1 (Main) OnSubjobOk row2 (Main) OnSubjobOk row3 (Main) OnSubjobOk tFixedFlowInput_1 tBufferOutput_1 tBufferInput_1 tLogRow_1 tBufferInput_2 tLogRow_2 tJava_1

Une colonne data de type byte[] partout, qui vaut "café".getBytes(java.nio.charset.StandardCharsets.UTF_8). tBufferInput_1 : Encodage par défaut, "ISO-8859-15". tBufferInput_2 : "UTF-8". Code du tJava_1 : A data column of type byte[] everywhere, set to "café".getBytes(java.nio.charset.StandardCharsets.UTF_8). tBufferInput_1: default Encoding, "ISO-8859-15". tBufferInput_2: "UTF-8". tJava_1 code:

System.out.println("file.encoding: " + java.nio.charset.Charset.defaultCharset());
[tLogRow_1] caf�
[tLogRow_2] café
file.encoding: UTF-8

L'encodage par défaut de la machine Java est UTF-8 : c'est avec lui que le tBufferOutput a écrit le texte. Seul le tBufferInput_2, en UTF-8, retrouve les octets de départ. The default encoding of the Java machine is UTF-8: the tBufferOutput wrote the text with it. Only tBufferInput_2, in UTF-8, gets the original bytes back.

ErreursErrors

Le nom du job est remplacé par MyJob et les traces sont abrégées. Dans les deux cas, le job s'arrête avec le code 1. The job name is replaced with MyJob and the traces are shortened. In both cases, the job stops with code 1.

Colonnes dans un autre ordreColumns in another order

Le tampon contient les lignes 1 Ada et 2 Grace, rangées par un tBufferOutput aux colonnes id (Integer), name. Le tBufferInput_1 a les colonnes name (String), puis id (Integer). The buffer holds the rows 1 Ada and 2 Grace, stored by a tBufferOutput with the columns id (Integer), name. tBufferInput_1 has the columns name (String), then id (Integer).

Exception in component tBufferInput_1 (MyJob)
java.lang.NumberFormatException: For input string: "Ada"
	at …

Par position, la 2e valeur, Ada, arrive dans id, un Integer. By position, the 2nd value, Ada, goes into id, an Integer.

Modèle de date différentDifferent date pattern

La colonne day (Date) a le modèle "dd-MM-yyyy" dans le tBufferOutput_1, "yyyy-MM-dd" dans le tBufferInput_1. La date est le 11 novembre 2026. The day column (Date) has the pattern "dd-MM-yyyy" in tBufferOutput_1, "yyyy-MM-dd" in tBufferInput_1. The date is November 11, 2026.

Exception in component tBufferInput_1 (MyJob)
java.lang.RuntimeException: Unparseable date: "11-11-2026"
	at …

La date a été gardée avec le modèle du tBufferOutput_1 ; relue avec un autre, elle ne se convertit plus. The date was kept with the pattern of tBufferOutput_1; read with another one, it no longer converts.

Conseils et limitesTips and limits

Ordre des sous-jobsSubjob order

Reliez toujours le sous-job des tBufferOutput à celui du tBufferInput par On Subjob Ok. Lu trop tôt, le tampon est vide, sans message d'erreur (exemple) : l'oubli passe facilement inaperçu. Always connect the subjob of the tBufferOutput components to the one of the tBufferInput with On Subjob Ok. Read too early, the buffer is empty, without error message (example): the mistake easily goes unnoticed.

Même ordre, mêmes typesSame order, same types

Reprenez les colonnes du tBufferOutput dans le même ordre, avec les mêmes types et, pour les dates, le même modèle. Les noms, eux, peuvent changer. Take the columns of the tBufferOutput in the same order, with the same types and, for dates, the same pattern. The names, however, may change.

Un seul tampon par jobA single buffer per job

Un tBufferInput lit les lignes de tous les tBufferOutput du job, sans pouvoir en choisir un. Pour garder des ensembles séparés, prenez tHashOutput et tHashInput. A tBufferInput reads the rows of all the tBufferOutput components of the job, without being able to choose one. To keep separate sets, use tHashOutput and tHashInput.

Tout reste en mémoireEverything stays in memory

La lecture ne libère rien : le tampon reste en mémoire jusqu'à la fin du job. Pour un gros volume, prévoyez la mémoire (-Xmx) ou passez par un fichier. Reading frees nothing: the buffer stays in memory until the end of the job. For a large volume, plan the memory (-Xmx) or go through a file.

Voir aussiSee also