001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.parser;
014
015import static org.apache.juneau.collections.JsonMap.*;
016import java.lang.annotation.*;
017import java.lang.reflect.*;
018import java.nio.charset.*;
019import java.util.*;
020
021import org.apache.juneau.*;
022import org.apache.juneau.collections.*;
023import org.apache.juneau.common.internal.*;
024import org.apache.juneau.internal.*;
025import org.apache.juneau.utils.*;
026
027/**
028 * Subclass of {@link Parser} for characters-based parsers.
029 *
030 * <h5 class='topic'>Description</h5>
031 * <p>
032 * This class is typically the parent class of all character-based parsers.
033 * It has 1 abstract method to implement on the session object...
034 * <ul>
035 *    <li><c>parse(ParserSession, ClassMeta)</c>
036 * </ul>
037 *
038 * <h5 class='section'>Notes:</h5><ul>
039 *    <li class='note'>This class is thread safe and reusable.
040 * </ul>
041 *
042 * <h5 class='section'>See Also:</h5><ul>
043 *    <li class='link'><a class="doclink" href="../../../../index.html#jm.SerializersAndParsers">Serializers and Parsers</a>
044 * </ul>
045 */
046public class ReaderParser extends Parser {
047
048   //-------------------------------------------------------------------------------------------------------------------
049   // Static
050   //-------------------------------------------------------------------------------------------------------------------
051
052   /**
053    * Creates a new builder for this object.
054    *
055    * @return A new builder.
056    */
057   public static Builder create() {
058      return new Builder();
059   }
060
061   //-----------------------------------------------------------------------------------------------------------------
062   // Builder
063   //-----------------------------------------------------------------------------------------------------------------
064
065   /**
066    * Builder class.
067    */
068   @FluentSetters
069   public static class Builder extends Parser.Builder {
070
071      Charset fileCharset, streamCharset;
072
073      /**
074       * Constructor, default settings.
075       */
076      protected Builder() {
077         fileCharset = env("ReaderParser.fileCharset", Charset.defaultCharset());
078         streamCharset = env("ReaderParser.streamCharset", IOUtils.UTF8);
079      }
080
081      /**
082       * Copy constructor.
083       *
084       * @param copyFrom The bean to copy from.
085       */
086      protected Builder(ReaderParser copyFrom) {
087         super(copyFrom);
088         fileCharset = copyFrom.fileCharset;
089         streamCharset = copyFrom.streamCharset;
090      }
091
092      /**
093       * Copy constructor.
094       *
095       * @param copyFrom The builder to copy from.
096       */
097      protected Builder(Builder copyFrom) {
098         super(copyFrom);
099         fileCharset = copyFrom.fileCharset;
100         streamCharset = copyFrom.streamCharset;
101      }
102
103      @Override /* Context.Builder */
104      public Builder copy() {
105         return new Builder(this);
106      }
107
108      @Override /* Context.Builder */
109      public ReaderParser build() {
110         return build(ReaderParser.class);
111      }
112
113      @Override /* Context.Builder */
114      public HashKey hashKey() {
115         return HashKey.of(
116            super.hashKey(),
117            fileCharset,
118            streamCharset
119         );
120      }
121
122      //-----------------------------------------------------------------------------------------------------------------
123      // Properties
124      //-----------------------------------------------------------------------------------------------------------------
125
126      /**
127       * File charset.
128       *
129       * <p>
130       * The character set to use for reading <c>Files</c> from the file system.
131       *
132       * <p>
133       * Used when passing in files to {@link Parser#parse(Object, Class)}.
134       *
135       * <h5 class='section'>Example:</h5>
136       * <p class='bjava'>
137       *    <jc>// Create a parser that reads UTF-8 files.</jc>
138       *    ReaderParser <jv>parser</jv> = JsonParser
139       *       .<jsm>create</jsm>()
140       *       .fileCharset(<js>"UTF-8"</js>)
141       *       .build();
142       *
143       *    <jc>// Use it to read a UTF-8 encoded file.</jc>
144       *    MyBean <jv>myBean</jv> = <jv>parser</jv>.parse(<jk>new</jk> File(<js>"MyBean.txt"</js>), MyBean.<jk>class</jk>);
145       * </p>
146       *
147       * @param value
148       *    The new value for this property.
149       *    <br>The default value is <js>"DEFAULT"</js> which causes the system default to be used.
150       * @return This object.
151       */
152      @FluentSetter
153      public Builder fileCharset(Charset value) {
154         fileCharset = value;
155         return this;
156      }
157
158      /**
159       * Input stream charset.
160       *
161       * <p>
162       * The character set to use for converting <c>InputStreams</c> and byte arrays to readers.
163       *
164       * <p>
165       * Used when passing in input streams and byte arrays to {@link Parser#parse(Object, Class)}.
166       *
167       * <h5 class='section'>Example:</h5>
168       * <p class='bjava'>
169       *    <jc>// Create a parser that reads UTF-8 files.</jc>
170       *    ReaderParser <jv>parser</jv> = JsonParser
171       *       .<jsm>create</jsm>()
172       *       .streamCharset(Charset.<jsm>forName</jsm>(<js>"UTF-8"</js>))
173       *       .build();
174       *
175       *    <jc>// Use it to read a UTF-8 encoded input stream.</jc>
176       *    MyBean <jv>myBean</jv> = <jv>parser</jv>.parse(<jk>new</jk> FileInputStream(<js>"MyBean.txt"</js>), MyBean.<jk>class</jk>);
177       * </p>
178       *
179       * @param value
180       *    The new value for this property.
181       *    <br>The default value is <js>"UTF-8"</js>.
182       * @return This object.
183       */
184      @FluentSetter
185      public Builder streamCharset(Charset value) {
186         streamCharset = value;
187         return this;
188      }
189
190      // <FluentSetters>
191
192      @Override /* GENERATED - org.apache.juneau.Context.Builder */
193      public Builder annotations(Annotation...values) {
194         super.annotations(values);
195         return this;
196      }
197
198      @Override /* GENERATED - org.apache.juneau.Context.Builder */
199      public Builder apply(AnnotationWorkList work) {
200         super.apply(work);
201         return this;
202      }
203
204      @Override /* GENERATED - org.apache.juneau.Context.Builder */
205      public Builder applyAnnotations(java.lang.Class<?>...fromClasses) {
206         super.applyAnnotations(fromClasses);
207         return this;
208      }
209
210      @Override /* GENERATED - org.apache.juneau.Context.Builder */
211      public Builder applyAnnotations(Method...fromMethods) {
212         super.applyAnnotations(fromMethods);
213         return this;
214      }
215
216      @Override /* GENERATED - org.apache.juneau.Context.Builder */
217      public Builder cache(Cache<HashKey,? extends org.apache.juneau.Context> value) {
218         super.cache(value);
219         return this;
220      }
221
222      @Override /* GENERATED - org.apache.juneau.Context.Builder */
223      public Builder debug() {
224         super.debug();
225         return this;
226      }
227
228      @Override /* GENERATED - org.apache.juneau.Context.Builder */
229      public Builder debug(boolean value) {
230         super.debug(value);
231         return this;
232      }
233
234      @Override /* GENERATED - org.apache.juneau.Context.Builder */
235      public Builder impl(Context value) {
236         super.impl(value);
237         return this;
238      }
239
240      @Override /* GENERATED - org.apache.juneau.Context.Builder */
241      public Builder type(Class<? extends org.apache.juneau.Context> value) {
242         super.type(value);
243         return this;
244      }
245
246      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
247      public Builder beanClassVisibility(Visibility value) {
248         super.beanClassVisibility(value);
249         return this;
250      }
251
252      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
253      public Builder beanConstructorVisibility(Visibility value) {
254         super.beanConstructorVisibility(value);
255         return this;
256      }
257
258      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
259      public Builder beanContext(BeanContext value) {
260         super.beanContext(value);
261         return this;
262      }
263
264      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
265      public Builder beanContext(BeanContext.Builder value) {
266         super.beanContext(value);
267         return this;
268      }
269
270      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
271      public Builder beanDictionary(java.lang.Class<?>...values) {
272         super.beanDictionary(values);
273         return this;
274      }
275
276      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
277      public Builder beanFieldVisibility(Visibility value) {
278         super.beanFieldVisibility(value);
279         return this;
280      }
281
282      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
283      public Builder beanInterceptor(Class<?> on, Class<? extends org.apache.juneau.swap.BeanInterceptor<?>> value) {
284         super.beanInterceptor(on, value);
285         return this;
286      }
287
288      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
289      public Builder beanMapPutReturnsOldValue() {
290         super.beanMapPutReturnsOldValue();
291         return this;
292      }
293
294      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
295      public Builder beanMethodVisibility(Visibility value) {
296         super.beanMethodVisibility(value);
297         return this;
298      }
299
300      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
301      public Builder beanProperties(Map<String,Object> values) {
302         super.beanProperties(values);
303         return this;
304      }
305
306      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
307      public Builder beanProperties(Class<?> beanClass, String properties) {
308         super.beanProperties(beanClass, properties);
309         return this;
310      }
311
312      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
313      public Builder beanProperties(String beanClassName, String properties) {
314         super.beanProperties(beanClassName, properties);
315         return this;
316      }
317
318      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
319      public Builder beanPropertiesExcludes(Map<String,Object> values) {
320         super.beanPropertiesExcludes(values);
321         return this;
322      }
323
324      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
325      public Builder beanPropertiesExcludes(Class<?> beanClass, String properties) {
326         super.beanPropertiesExcludes(beanClass, properties);
327         return this;
328      }
329
330      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
331      public Builder beanPropertiesExcludes(String beanClassName, String properties) {
332         super.beanPropertiesExcludes(beanClassName, properties);
333         return this;
334      }
335
336      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
337      public Builder beanPropertiesReadOnly(Map<String,Object> values) {
338         super.beanPropertiesReadOnly(values);
339         return this;
340      }
341
342      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
343      public Builder beanPropertiesReadOnly(Class<?> beanClass, String properties) {
344         super.beanPropertiesReadOnly(beanClass, properties);
345         return this;
346      }
347
348      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
349      public Builder beanPropertiesReadOnly(String beanClassName, String properties) {
350         super.beanPropertiesReadOnly(beanClassName, properties);
351         return this;
352      }
353
354      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
355      public Builder beanPropertiesWriteOnly(Map<String,Object> values) {
356         super.beanPropertiesWriteOnly(values);
357         return this;
358      }
359
360      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
361      public Builder beanPropertiesWriteOnly(Class<?> beanClass, String properties) {
362         super.beanPropertiesWriteOnly(beanClass, properties);
363         return this;
364      }
365
366      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
367      public Builder beanPropertiesWriteOnly(String beanClassName, String properties) {
368         super.beanPropertiesWriteOnly(beanClassName, properties);
369         return this;
370      }
371
372      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
373      public Builder beansRequireDefaultConstructor() {
374         super.beansRequireDefaultConstructor();
375         return this;
376      }
377
378      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
379      public Builder beansRequireSerializable() {
380         super.beansRequireSerializable();
381         return this;
382      }
383
384      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
385      public Builder beansRequireSettersForGetters() {
386         super.beansRequireSettersForGetters();
387         return this;
388      }
389
390      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
391      public Builder dictionaryOn(Class<?> on, java.lang.Class<?>...values) {
392         super.dictionaryOn(on, values);
393         return this;
394      }
395
396      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
397      public Builder disableBeansRequireSomeProperties() {
398         super.disableBeansRequireSomeProperties();
399         return this;
400      }
401
402      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
403      public Builder disableIgnoreMissingSetters() {
404         super.disableIgnoreMissingSetters();
405         return this;
406      }
407
408      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
409      public Builder disableIgnoreTransientFields() {
410         super.disableIgnoreTransientFields();
411         return this;
412      }
413
414      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
415      public Builder disableIgnoreUnknownNullBeanProperties() {
416         super.disableIgnoreUnknownNullBeanProperties();
417         return this;
418      }
419
420      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
421      public Builder disableInterfaceProxies() {
422         super.disableInterfaceProxies();
423         return this;
424      }
425
426      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
427      public <T> Builder example(Class<T> pojoClass, T o) {
428         super.example(pojoClass, o);
429         return this;
430      }
431
432      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
433      public <T> Builder example(Class<T> pojoClass, String json) {
434         super.example(pojoClass, json);
435         return this;
436      }
437
438      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
439      public Builder findFluentSetters() {
440         super.findFluentSetters();
441         return this;
442      }
443
444      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
445      public Builder findFluentSetters(Class<?> on) {
446         super.findFluentSetters(on);
447         return this;
448      }
449
450      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
451      public Builder ignoreInvocationExceptionsOnGetters() {
452         super.ignoreInvocationExceptionsOnGetters();
453         return this;
454      }
455
456      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
457      public Builder ignoreInvocationExceptionsOnSetters() {
458         super.ignoreInvocationExceptionsOnSetters();
459         return this;
460      }
461
462      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
463      public Builder ignoreUnknownBeanProperties() {
464         super.ignoreUnknownBeanProperties();
465         return this;
466      }
467
468      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
469      public Builder ignoreUnknownEnumValues() {
470         super.ignoreUnknownEnumValues();
471         return this;
472      }
473
474      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
475      public Builder implClass(Class<?> interfaceClass, Class<?> implClass) {
476         super.implClass(interfaceClass, implClass);
477         return this;
478      }
479
480      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
481      public Builder implClasses(Map<Class<?>,Class<?>> values) {
482         super.implClasses(values);
483         return this;
484      }
485
486      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
487      public Builder interfaceClass(Class<?> on, Class<?> value) {
488         super.interfaceClass(on, value);
489         return this;
490      }
491
492      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
493      public Builder interfaces(java.lang.Class<?>...value) {
494         super.interfaces(value);
495         return this;
496      }
497
498      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
499      public Builder locale(Locale value) {
500         super.locale(value);
501         return this;
502      }
503
504      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
505      public Builder mediaType(MediaType value) {
506         super.mediaType(value);
507         return this;
508      }
509
510      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
511      public Builder notBeanClasses(java.lang.Class<?>...values) {
512         super.notBeanClasses(values);
513         return this;
514      }
515
516      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
517      public Builder notBeanPackages(String...values) {
518         super.notBeanPackages(values);
519         return this;
520      }
521
522      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
523      public Builder propertyNamer(Class<? extends org.apache.juneau.PropertyNamer> value) {
524         super.propertyNamer(value);
525         return this;
526      }
527
528      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
529      public Builder propertyNamer(Class<?> on, Class<? extends org.apache.juneau.PropertyNamer> value) {
530         super.propertyNamer(on, value);
531         return this;
532      }
533
534      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
535      public Builder sortProperties() {
536         super.sortProperties();
537         return this;
538      }
539
540      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
541      public Builder sortProperties(java.lang.Class<?>...on) {
542         super.sortProperties(on);
543         return this;
544      }
545
546      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
547      public Builder stopClass(Class<?> on, Class<?> value) {
548         super.stopClass(on, value);
549         return this;
550      }
551
552      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
553      public <T, S> Builder swap(Class<T> normalClass, Class<S> swappedClass, ThrowingFunction<T,S> swapFunction) {
554         super.swap(normalClass, swappedClass, swapFunction);
555         return this;
556      }
557
558      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
559      public <T, S> Builder swap(Class<T> normalClass, Class<S> swappedClass, ThrowingFunction<T,S> swapFunction, ThrowingFunction<S,T> unswapFunction) {
560         super.swap(normalClass, swappedClass, swapFunction, unswapFunction);
561         return this;
562      }
563
564      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
565      public Builder swaps(java.lang.Class<?>...values) {
566         super.swaps(values);
567         return this;
568      }
569
570      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
571      public Builder timeZone(TimeZone value) {
572         super.timeZone(value);
573         return this;
574      }
575
576      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
577      public Builder typeName(Class<?> on, String value) {
578         super.typeName(on, value);
579         return this;
580      }
581
582      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
583      public Builder typePropertyName(String value) {
584         super.typePropertyName(value);
585         return this;
586      }
587
588      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
589      public Builder typePropertyName(Class<?> on, String value) {
590         super.typePropertyName(on, value);
591         return this;
592      }
593
594      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
595      public Builder useEnumNames() {
596         super.useEnumNames();
597         return this;
598      }
599
600      @Override /* GENERATED - org.apache.juneau.BeanContextable.Builder */
601      public Builder useJavaBeanIntrospector() {
602         super.useJavaBeanIntrospector();
603         return this;
604      }
605
606      @Override /* GENERATED - org.apache.juneau.parser.Parser.Builder */
607      public Builder autoCloseStreams() {
608         super.autoCloseStreams();
609         return this;
610      }
611
612      @Override /* GENERATED - org.apache.juneau.parser.Parser.Builder */
613      public Builder autoCloseStreams(boolean value) {
614         super.autoCloseStreams(value);
615         return this;
616      }
617
618      @Override /* GENERATED - org.apache.juneau.parser.Parser.Builder */
619      public Builder consumes(String value) {
620         super.consumes(value);
621         return this;
622      }
623
624      @Override /* GENERATED - org.apache.juneau.parser.Parser.Builder */
625      public Builder debugOutputLines(int value) {
626         super.debugOutputLines(value);
627         return this;
628      }
629
630      @Override /* GENERATED - org.apache.juneau.parser.Parser.Builder */
631      public Builder listener(Class<? extends org.apache.juneau.parser.ParserListener> value) {
632         super.listener(value);
633         return this;
634      }
635
636      @Override /* GENERATED - org.apache.juneau.parser.Parser.Builder */
637      public Builder strict() {
638         super.strict();
639         return this;
640      }
641
642      @Override /* GENERATED - org.apache.juneau.parser.Parser.Builder */
643      public Builder strict(boolean value) {
644         super.strict(value);
645         return this;
646      }
647
648      @Override /* GENERATED - org.apache.juneau.parser.Parser.Builder */
649      public Builder trimStrings() {
650         super.trimStrings();
651         return this;
652      }
653
654      @Override /* GENERATED - org.apache.juneau.parser.Parser.Builder */
655      public Builder trimStrings(boolean value) {
656         super.trimStrings(value);
657         return this;
658      }
659
660      @Override /* GENERATED - org.apache.juneau.parser.Parser.Builder */
661      public Builder unbuffered() {
662         super.unbuffered();
663         return this;
664      }
665
666      @Override /* GENERATED - org.apache.juneau.parser.Parser.Builder */
667      public Builder unbuffered(boolean value) {
668         super.unbuffered(value);
669         return this;
670      }
671
672      // </FluentSetters>
673   }
674
675   //-------------------------------------------------------------------------------------------------------------------
676   // Instance
677   //-------------------------------------------------------------------------------------------------------------------
678
679   final Charset streamCharset, fileCharset;
680
681   /**
682    * Constructor.
683    *
684    * @param builder The builder for this object.
685    */
686   protected ReaderParser(Builder builder) {
687      super(builder);
688      streamCharset = builder.streamCharset;
689      fileCharset = builder.fileCharset;
690   }
691
692   @Override /* Parser */
693   public final boolean isReaderParser() {
694      return true;
695   }
696
697   @Override /* Context */
698   public ReaderParserSession.Builder createSession() {
699      return ReaderParserSession.create(this);
700   }
701
702   @Override /* Context */
703   public ReaderParserSession getSession() {
704      return createSession().build();
705   }
706
707   //-----------------------------------------------------------------------------------------------------------------
708   // Properties
709   //-----------------------------------------------------------------------------------------------------------------
710
711   /**
712    * File charset.
713    *
714    * @see Builder#fileCharset(Charset)
715    * @return
716    *    The character set to use for reading <c>Files</c> from the file system.
717    */
718   protected final Charset getFileCharset() {
719      return fileCharset;
720   }
721
722   /**
723    * Input stream charset.
724    *
725    * @see Builder#streamCharset(Charset)
726    * @return
727    *    The character set to use for converting <c>InputStreams</c> and byte arrays to readers.
728    */
729   protected final Charset getStreamCharset() {
730      return streamCharset;
731   }
732
733   //-----------------------------------------------------------------------------------------------------------------
734   // Other methods
735   //-----------------------------------------------------------------------------------------------------------------
736
737   @Override /* Context */
738   protected JsonMap properties() {
739      return filteredMap("fileCharset", fileCharset, "streamCharset", streamCharset);
740   }
741}