< prev index next >

src/java.base/share/classes/java/nio/charset/Charset-X-Coder.java.template

Print this page




 178      *         The initial replacement; must not be {@code null}, must have
 179      *         non-zero length, must not be longer than max$ItypesPerOtype$,
 180      *         and must be {@linkplain #isLegalReplacement legal}
 181      *
 182      * @throws  IllegalArgumentException
 183      *          If the preconditions on the parameters do not hold
 184      */
 185     {#if[encoder]?protected:private}
 186     Charset$Coder$(Charset cs,
 187                    float average$ItypesPerOtype$,
 188                    float max$ItypesPerOtype$,
 189                    $replType$ replacement)
 190     {
 191         this.charset = cs;
 192         if (average$ItypesPerOtype$ <= 0.0f)
 193             throw new IllegalArgumentException("Non-positive "
 194                                                + "average$ItypesPerOtype$");
 195         if (max$ItypesPerOtype$ <= 0.0f)
 196             throw new IllegalArgumentException("Non-positive "
 197                                                + "max$ItypesPerOtype$");
 198         if (!Charset.atBugLevel("1.4")) {
 199             if (average$ItypesPerOtype$ > max$ItypesPerOtype$)
 200                 throw new IllegalArgumentException("average$ItypesPerOtype$"
 201                                                    + " exceeds "
 202                                                    + "max$ItypesPerOtype$");
 203         }
 204         this.replacement = replacement;
 205         this.average$ItypesPerOtype$ = average$ItypesPerOtype$;
 206         this.max$ItypesPerOtype$ = max$ItypesPerOtype$;
 207         replaceWith(replacement);
 208     }
 209 
 210     /**
 211      * Initializes a new $coder$.  The new $coder$ will have the given
 212      * $otypes-per-itype$ values and its replacement will be the
 213      * $replTypeName$ $defaultReplName$.
 214      *
 215      * @param  cs
 216      *         The charset that created this $coder$
 217      *
 218      * @param  average$ItypesPerOtype$
 219      *         A positive float value indicating the expected number of
 220      *         $otype$s that will be produced for each input $itype$
 221      *
 222      * @param  max$ItypesPerOtype$
 223      *         A positive float value indicating the maximum number of




 178      *         The initial replacement; must not be {@code null}, must have
 179      *         non-zero length, must not be longer than max$ItypesPerOtype$,
 180      *         and must be {@linkplain #isLegalReplacement legal}
 181      *
 182      * @throws  IllegalArgumentException
 183      *          If the preconditions on the parameters do not hold
 184      */
 185     {#if[encoder]?protected:private}
 186     Charset$Coder$(Charset cs,
 187                    float average$ItypesPerOtype$,
 188                    float max$ItypesPerOtype$,
 189                    $replType$ replacement)
 190     {
 191         this.charset = cs;
 192         if (average$ItypesPerOtype$ <= 0.0f)
 193             throw new IllegalArgumentException("Non-positive "
 194                                                + "average$ItypesPerOtype$");
 195         if (max$ItypesPerOtype$ <= 0.0f)
 196             throw new IllegalArgumentException("Non-positive "
 197                                                + "max$ItypesPerOtype$");

 198         if (average$ItypesPerOtype$ > max$ItypesPerOtype$)
 199             throw new IllegalArgumentException("average$ItypesPerOtype$"
 200                                                + " exceeds "
 201                                                + "max$ItypesPerOtype$");

 202         this.replacement = replacement;
 203         this.average$ItypesPerOtype$ = average$ItypesPerOtype$;
 204         this.max$ItypesPerOtype$ = max$ItypesPerOtype$;
 205         replaceWith(replacement);
 206     }
 207 
 208     /**
 209      * Initializes a new $coder$.  The new $coder$ will have the given
 210      * $otypes-per-itype$ values and its replacement will be the
 211      * $replTypeName$ $defaultReplName$.
 212      *
 213      * @param  cs
 214      *         The charset that created this $coder$
 215      *
 216      * @param  average$ItypesPerOtype$
 217      *         A positive float value indicating the expected number of
 218      *         $otype$s that will be produced for each input $itype$
 219      *
 220      * @param  max$ItypesPerOtype$
 221      *         A positive float value indicating the maximum number of


< prev index next >