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