1
1
// Copyright 2013 The Flutter Authors. All rights reserved.
2
2
// Use of this source code is governed by a BSD-style license that can be
3
3
// found in the LICENSE file.
4
- // Autogenerated from Pigeon (v9.2.5 ), do not edit directly.
4
+ // Autogenerated from Pigeon (v22.4.2 ), do not edit directly.
5
5
// See also: https://pub.dev/packages/pigeon
6
6
7
7
package io .flutter .plugins .pathprovider ;
13
13
import io .flutter .plugin .common .BinaryMessenger ;
14
14
import io .flutter .plugin .common .MessageCodec ;
15
15
import io .flutter .plugin .common .StandardMessageCodec ;
16
+ import java .io .ByteArrayOutputStream ;
17
+ import java .nio .ByteBuffer ;
16
18
import java .util .ArrayList ;
17
19
import java .util .List ;
18
20
@@ -38,7 +40,7 @@ public FlutterError(@NonNull String code, @Nullable String message, @Nullable Ob
38
40
39
41
@ NonNull
40
42
protected static ArrayList <Object > wrapError (@ NonNull Throwable exception ) {
41
- ArrayList <Object > errorList = new ArrayList <Object >(3 );
43
+ ArrayList <Object > errorList = new ArrayList <>(3 );
42
44
if (exception instanceof FlutterError ) {
43
45
FlutterError error = (FlutterError ) exception ;
44
46
errorList .add (error .code );
@@ -68,10 +70,40 @@ public enum StorageDirectory {
68
70
69
71
final int index ;
70
72
71
- private StorageDirectory (final int index ) {
73
+ StorageDirectory (final int index ) {
72
74
this .index = index ;
73
75
}
74
76
}
77
+
78
+ private static class PigeonCodec extends StandardMessageCodec {
79
+ public static final PigeonCodec INSTANCE = new PigeonCodec ();
80
+
81
+ private PigeonCodec () {}
82
+
83
+ @ Override
84
+ protected Object readValueOfType (byte type , @ NonNull ByteBuffer buffer ) {
85
+ switch (type ) {
86
+ case (byte ) 129 :
87
+ {
88
+ Object value = readValue (buffer );
89
+ return value == null ? null : StorageDirectory .values ()[((Long ) value ).intValue ()];
90
+ }
91
+ default :
92
+ return super .readValueOfType (type , buffer );
93
+ }
94
+ }
95
+
96
+ @ Override
97
+ protected void writeValue (@ NonNull ByteArrayOutputStream stream , Object value ) {
98
+ if (value instanceof StorageDirectory ) {
99
+ stream .write (129 );
100
+ writeValue (stream , value == null ? null : ((StorageDirectory ) value ).index );
101
+ } else {
102
+ super .writeValue (stream , value );
103
+ }
104
+ }
105
+ }
106
+
75
107
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
76
108
public interface PathProviderApi {
77
109
@@ -98,30 +130,38 @@ public interface PathProviderApi {
98
130
99
131
/** The codec used by PathProviderApi. */
100
132
static @ NonNull MessageCodec <Object > getCodec () {
101
- return new StandardMessageCodec () ;
133
+ return PigeonCodec . INSTANCE ;
102
134
}
103
135
/**
104
136
* Sets up an instance of `PathProviderApi` to handle messages through the `binaryMessenger`.
105
137
*/
106
- static void setup (@ NonNull BinaryMessenger binaryMessenger , @ Nullable PathProviderApi api ) {
138
+ static void setUp (@ NonNull BinaryMessenger binaryMessenger , @ Nullable PathProviderApi api ) {
139
+ setUp (binaryMessenger , "" , api );
140
+ }
141
+
142
+ static void setUp (
143
+ @ NonNull BinaryMessenger binaryMessenger ,
144
+ @ NonNull String messageChannelSuffix ,
145
+ @ Nullable PathProviderApi api ) {
146
+ messageChannelSuffix = messageChannelSuffix .isEmpty () ? "" : "." + messageChannelSuffix ;
107
147
{
108
148
BinaryMessenger .TaskQueue taskQueue = binaryMessenger .makeBackgroundTaskQueue ();
109
149
BasicMessageChannel <Object > channel =
110
150
new BasicMessageChannel <>(
111
151
binaryMessenger ,
112
- "dev.flutter.pigeon.PathProviderApi.getTemporaryPath" ,
152
+ "dev.flutter.pigeon.path_provider_android.PathProviderApi.getTemporaryPath"
153
+ + messageChannelSuffix ,
113
154
getCodec (),
114
155
taskQueue );
115
156
if (api != null ) {
116
157
channel .setMessageHandler (
117
158
(message , reply ) -> {
118
- ArrayList <Object > wrapped = new ArrayList <Object >();
159
+ ArrayList <Object > wrapped = new ArrayList <>();
119
160
try {
120
161
String output = api .getTemporaryPath ();
121
162
wrapped .add (0 , output );
122
163
} catch (Throwable exception ) {
123
- ArrayList <Object > wrappedError = wrapError (exception );
124
- wrapped = wrappedError ;
164
+ wrapped = wrapError (exception );
125
165
}
126
166
reply .reply (wrapped );
127
167
});
@@ -134,19 +174,19 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PathProvid
134
174
BasicMessageChannel <Object > channel =
135
175
new BasicMessageChannel <>(
136
176
binaryMessenger ,
137
- "dev.flutter.pigeon.PathProviderApi.getApplicationSupportPath" ,
177
+ "dev.flutter.pigeon.path_provider_android.PathProviderApi.getApplicationSupportPath"
178
+ + messageChannelSuffix ,
138
179
getCodec (),
139
180
taskQueue );
140
181
if (api != null ) {
141
182
channel .setMessageHandler (
142
183
(message , reply ) -> {
143
- ArrayList <Object > wrapped = new ArrayList <Object >();
184
+ ArrayList <Object > wrapped = new ArrayList <>();
144
185
try {
145
186
String output = api .getApplicationSupportPath ();
146
187
wrapped .add (0 , output );
147
188
} catch (Throwable exception ) {
148
- ArrayList <Object > wrappedError = wrapError (exception );
149
- wrapped = wrappedError ;
189
+ wrapped = wrapError (exception );
150
190
}
151
191
reply .reply (wrapped );
152
192
});
@@ -159,19 +199,19 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PathProvid
159
199
BasicMessageChannel <Object > channel =
160
200
new BasicMessageChannel <>(
161
201
binaryMessenger ,
162
- "dev.flutter.pigeon.PathProviderApi.getApplicationDocumentsPath" ,
202
+ "dev.flutter.pigeon.path_provider_android.PathProviderApi.getApplicationDocumentsPath"
203
+ + messageChannelSuffix ,
163
204
getCodec (),
164
205
taskQueue );
165
206
if (api != null ) {
166
207
channel .setMessageHandler (
167
208
(message , reply ) -> {
168
- ArrayList <Object > wrapped = new ArrayList <Object >();
209
+ ArrayList <Object > wrapped = new ArrayList <>();
169
210
try {
170
211
String output = api .getApplicationDocumentsPath ();
171
212
wrapped .add (0 , output );
172
213
} catch (Throwable exception ) {
173
- ArrayList <Object > wrappedError = wrapError (exception );
174
- wrapped = wrappedError ;
214
+ wrapped = wrapError (exception );
175
215
}
176
216
reply .reply (wrapped );
177
217
});
@@ -184,19 +224,19 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PathProvid
184
224
BasicMessageChannel <Object > channel =
185
225
new BasicMessageChannel <>(
186
226
binaryMessenger ,
187
- "dev.flutter.pigeon.PathProviderApi.getApplicationCachePath" ,
227
+ "dev.flutter.pigeon.path_provider_android.PathProviderApi.getApplicationCachePath"
228
+ + messageChannelSuffix ,
188
229
getCodec (),
189
230
taskQueue );
190
231
if (api != null ) {
191
232
channel .setMessageHandler (
192
233
(message , reply ) -> {
193
- ArrayList <Object > wrapped = new ArrayList <Object >();
234
+ ArrayList <Object > wrapped = new ArrayList <>();
194
235
try {
195
236
String output = api .getApplicationCachePath ();
196
237
wrapped .add (0 , output );
197
238
} catch (Throwable exception ) {
198
- ArrayList <Object > wrappedError = wrapError (exception );
199
- wrapped = wrappedError ;
239
+ wrapped = wrapError (exception );
200
240
}
201
241
reply .reply (wrapped );
202
242
});
@@ -209,19 +249,19 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PathProvid
209
249
BasicMessageChannel <Object > channel =
210
250
new BasicMessageChannel <>(
211
251
binaryMessenger ,
212
- "dev.flutter.pigeon.PathProviderApi.getExternalStoragePath" ,
252
+ "dev.flutter.pigeon.path_provider_android.PathProviderApi.getExternalStoragePath"
253
+ + messageChannelSuffix ,
213
254
getCodec (),
214
255
taskQueue );
215
256
if (api != null ) {
216
257
channel .setMessageHandler (
217
258
(message , reply ) -> {
218
- ArrayList <Object > wrapped = new ArrayList <Object >();
259
+ ArrayList <Object > wrapped = new ArrayList <>();
219
260
try {
220
261
String output = api .getExternalStoragePath ();
221
262
wrapped .add (0 , output );
222
263
} catch (Throwable exception ) {
223
- ArrayList <Object > wrappedError = wrapError (exception );
224
- wrapped = wrappedError ;
264
+ wrapped = wrapError (exception );
225
265
}
226
266
reply .reply (wrapped );
227
267
});
@@ -234,19 +274,19 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PathProvid
234
274
BasicMessageChannel <Object > channel =
235
275
new BasicMessageChannel <>(
236
276
binaryMessenger ,
237
- "dev.flutter.pigeon.PathProviderApi.getExternalCachePaths" ,
277
+ "dev.flutter.pigeon.path_provider_android.PathProviderApi.getExternalCachePaths"
278
+ + messageChannelSuffix ,
238
279
getCodec (),
239
280
taskQueue );
240
281
if (api != null ) {
241
282
channel .setMessageHandler (
242
283
(message , reply ) -> {
243
- ArrayList <Object > wrapped = new ArrayList <Object >();
284
+ ArrayList <Object > wrapped = new ArrayList <>();
244
285
try {
245
286
List <String > output = api .getExternalCachePaths ();
246
287
wrapped .add (0 , output );
247
288
} catch (Throwable exception ) {
248
- ArrayList <Object > wrappedError = wrapError (exception );
249
- wrapped = wrappedError ;
289
+ wrapped = wrapError (exception );
250
290
}
251
291
reply .reply (wrapped );
252
292
});
@@ -259,22 +299,21 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PathProvid
259
299
BasicMessageChannel <Object > channel =
260
300
new BasicMessageChannel <>(
261
301
binaryMessenger ,
262
- "dev.flutter.pigeon.PathProviderApi.getExternalStoragePaths" ,
302
+ "dev.flutter.pigeon.path_provider_android.PathProviderApi.getExternalStoragePaths"
303
+ + messageChannelSuffix ,
263
304
getCodec (),
264
305
taskQueue );
265
306
if (api != null ) {
266
307
channel .setMessageHandler (
267
308
(message , reply ) -> {
268
- ArrayList <Object > wrapped = new ArrayList <Object >();
309
+ ArrayList <Object > wrapped = new ArrayList <>();
269
310
ArrayList <Object > args = (ArrayList <Object >) message ;
270
- StorageDirectory directoryArg =
271
- args .get (0 ) == null ? null : StorageDirectory .values ()[(int ) args .get (0 )];
311
+ StorageDirectory directoryArg = (StorageDirectory ) args .get (0 );
272
312
try {
273
313
List <String > output = api .getExternalStoragePaths (directoryArg );
274
314
wrapped .add (0 , output );
275
315
} catch (Throwable exception ) {
276
- ArrayList <Object > wrappedError = wrapError (exception );
277
- wrapped = wrappedError ;
316
+ wrapped = wrapError (exception );
278
317
}
279
318
reply .reply (wrapped );
280
319
});
0 commit comments