1616
1717package io .appulse .utils ;
1818
19+ import static io .appulse .utils .BytesUtil .align ;
20+ import static io .appulse .utils .BytesUtil .asBytes ;
1921import static java .nio .charset .StandardCharsets .UTF_8 ;
2022import static lombok .AccessLevel .PRIVATE ;
2123
2931 * @author Artem Labazin
3032 * @since 1.0.0
3133 */
34+ @ SuppressWarnings ("checkstyle:AbbreviationAsWordInName" )
3235@ RequiredArgsConstructor
3336@ FieldDefaults (level = PRIVATE , makeFinal = true )
3437final class BytesDelegatePuts {
3538
3639 Bytes bytes ;
3740
41+ public Bytes putNB (byte value , int length ) {
42+ return bytes .put (align (asBytes (value ), length ));
43+ }
44+
45+ public Bytes putNB (int index , byte value , int length ) {
46+ return bytes .put (index , align (asBytes (value ), length ));
47+ }
48+
49+ public Bytes putNB (short value , int length ) {
50+ return bytes .put (align (asBytes (value ), length ));
51+ }
52+
53+ public Bytes putNB (int index , short value , int length ) {
54+ return bytes .put (index , align (asBytes (value ), length ));
55+ }
56+
57+ public Bytes putNB (int value , int length ) {
58+ return bytes .put (align (asBytes (value ), length ));
59+ }
60+
61+ public Bytes putNB (int index , int value , int length ) {
62+ return bytes .put (index , align (asBytes (value ), length ));
63+ }
64+
65+ public Bytes putNB (long value , int length ) {
66+ return bytes .put (align (asBytes (value ), length ));
67+ }
68+
69+ public Bytes putNB (int index , long value , int length ) {
70+ return bytes .put (index , align (asBytes (value ), length ));
71+ }
72+
73+ public Bytes putNB (byte [] value , int length ) {
74+ return bytes .put (align (value , length ));
75+ }
76+
77+ public Bytes putNB (int index , byte [] value , int length ) {
78+ return bytes .put (index , align (value , length ));
79+ }
80+
81+ public Bytes put1B (byte value ) {
82+ return bytes .put (value );
83+ }
84+
85+ public Bytes put1B (int index , byte value ) {
86+ return bytes .put (value );
87+ }
88+
89+ public Bytes put1B (short value ) {
90+ return bytes .put ((byte ) value );
91+ }
92+
93+ public Bytes put1B (int index , short value ) {
94+ return bytes .put (index , (byte ) value );
95+ }
96+
97+ public Bytes put1B (int value ) {
98+ return bytes .put ((byte ) value );
99+ }
100+
101+ public Bytes put1B (int index , int value ) {
102+ return bytes .put (index , (byte ) value );
103+ }
104+
105+ public Bytes put1B (long value ) {
106+ return bytes .put ((byte ) value );
107+ }
108+
109+ public Bytes put1B (int index , long value ) {
110+ return bytes .put (index , (byte ) value );
111+ }
112+
113+ public Bytes put2B (byte value ) {
114+ return putNB (value , 2 );
115+ }
116+
117+ public Bytes put2B (int index , byte value ) {
118+ return putNB (index , value , 2 );
119+ }
120+
121+ public Bytes put2B (short value ) {
122+ return putNB (value , 2 );
123+ }
124+
125+ public Bytes put2B (int index , short value ) {
126+ return putNB (index , value , 2 );
127+ }
128+
129+ public Bytes put2B (int value ) {
130+ return putNB (value , 2 );
131+ }
132+
133+ public Bytes put2B (int index , int value ) {
134+ return putNB (index , value , 2 );
135+ }
136+
137+ public Bytes put2B (long value ) {
138+ return putNB (value , 2 );
139+ }
140+
141+ public Bytes put2B (int index , long value ) {
142+ return putNB (index , value , 2 );
143+ }
144+
145+ public Bytes put4B (byte value ) {
146+ return putNB (value , 4 );
147+ }
148+
149+ public Bytes put4B (int index , byte value ) {
150+ return putNB (index , value , 4 );
151+ }
152+
153+ public Bytes put4B (short value ) {
154+ return putNB (value , 4 );
155+ }
156+
157+ public Bytes put4B (int index , short value ) {
158+ return putNB (index , value , 4 );
159+ }
160+
161+ public Bytes put4B (int value ) {
162+ return putNB (value , 4 );
163+ }
164+
165+ public Bytes put4B (int index , int value ) {
166+ return putNB (index , value , 4 );
167+ }
168+
169+ public Bytes put4B (long value ) {
170+ return putNB (value , 4 );
171+ }
172+
173+ public Bytes put4B (int index , long value ) {
174+ return putNB (index , value , 4 );
175+ }
176+
177+ public Bytes put8B (byte value ) {
178+ return putNB (value , 8 );
179+ }
180+
181+ public Bytes put8B (int index , byte value ) {
182+ return putNB (index , value , 8 );
183+ }
184+
185+ public Bytes put8B (short value ) {
186+ return putNB (value , 8 );
187+ }
188+
189+ public Bytes put8B (int index , short value ) {
190+ return putNB (index , value , 8 );
191+ }
192+
193+ public Bytes put8B (int value ) {
194+ return putNB (value , 8 );
195+ }
196+
197+ public Bytes put8B (int index , int value ) {
198+ return putNB (index , value , 8 );
199+ }
200+
201+ public Bytes put8B (long value ) {
202+ return putNB (value , 8 );
203+ }
204+
205+ public Bytes put8B (int index , long value ) {
206+ return putNB (index , value , 8 );
207+ }
208+
38209 public Bytes put (short value ) {
39- return bytes .put (BytesUtil . asBytes (value ));
210+ return bytes .put (asBytes (value ));
40211 }
41212
42213 public Bytes put (int index , short value ) {
43- return bytes .put (index , BytesUtil . asBytes (value ));
214+ return bytes .put (index , asBytes (value ));
44215 }
45216
46217 public Bytes put (int value ) {
47- return bytes .put (BytesUtil . asBytes (value ));
218+ return bytes .put (asBytes (value ));
48219 }
49220
50221 public Bytes put (int index , int value ) {
51- return bytes .put (index , BytesUtil . asBytes (value ));
222+ return bytes .put (index , asBytes (value ));
52223 }
53224
54225 public Bytes put (long value ) {
55- return bytes .put (BytesUtil . asBytes (value ));
226+ return bytes .put (asBytes (value ));
56227 }
57228
58229 public Bytes put (int index , long value ) {
59- return bytes .put (index , BytesUtil . asBytes (value ));
230+ return bytes .put (index , asBytes (value ));
60231 }
61232
62233 public Bytes put (float value ) {
63- return bytes .put (BytesUtil . asBytes (value ));
234+ return bytes .put (asBytes (value ));
64235 }
65236
66237 public Bytes put (int index , float value ) {
67- return bytes .put (index , BytesUtil . asBytes (value ));
238+ return bytes .put (index , asBytes (value ));
68239 }
69240
70241 public Bytes put (double value ) {
71- return bytes .put (BytesUtil . asBytes (value ));
242+ return bytes .put (asBytes (value ));
72243 }
73244
74245 public Bytes put (int index , double value ) {
75- return bytes .put (index , BytesUtil . asBytes (value ));
246+ return bytes .put (index , asBytes (value ));
76247 }
77248
78249 public Bytes put (char value ) {
79- return bytes .put (BytesUtil . asBytes (value ));
250+ return bytes .put (asBytes (value ));
80251 }
81252
82253 public Bytes put (int index , char value ) {
83- return bytes .put (index , BytesUtil . asBytes (value ));
254+ return bytes .put (index , asBytes (value ));
84255 }
85256
86257 public Bytes put (String value ) {
@@ -98,4 +269,12 @@ public Bytes put (int index, String value) {
98269 public Bytes put (int index , String value , Charset charset ) {
99270 return bytes .put (index , value .getBytes (charset ));
100271 }
272+
273+ public Bytes put (Bytes value ) {
274+ return bytes .put (value .array ());
275+ }
276+
277+ public Bytes put (int index , Bytes value ) {
278+ return bytes .put (index , value .array ());
279+ }
101280}
0 commit comments