public void setTargetEncoding (final String sTargetEncoding) { // Throws an exception on an illegal charset CharsetHelper.getCharsetFromName (sTargetEncoding); targetEncoding = sTargetEncoding; }
public void setCharacterEncoding (@Nullable final String sCharacterEncoding) { setCharacterEncoding (CharsetHelper.getCharsetFromNameOrNull (sCharacterEncoding)); }
@Nonnull private Charset _getCharset () { final String sResponseEncoding = m_aDelegate.getCharacterEncoding (); final Charset aCharset = CharsetHelper.getCharsetFromNameOrDefault (sResponseEncoding, StandardCharsets.UTF_8); return aCharset; }
return null; final InputStreamAndCharset aISAndBOM = CharsetHelper.getInputStreamAndCharsetFromBOM (aIS); final Charset aBOMCharset = aISAndBOM.getCharset (); Charset aStreamCharset = aBOMCharset; final Charset aReadCharset = CharsetHelper.getCharsetFromName (sPlainCharsetName);
/** * Read a document from the specified input stream. The secure reading feature * has affect when using this method. * * @param aIS * The input stream to read. May not be <code>null</code>. * @return <code>null</code> in case reading fails. */ @Nullable default JAXBTYPE read (@Nonnull final InputStream aIS) { ValueEnforcer.notNull (aIS, "InputStream"); final InputStreamAndCharset aISAndBOM = CharsetHelper.getInputStreamAndCharsetFromBOM (aIS); if (aISAndBOM.hasCharset ()) { // BOM was found - read from Reader return read (StreamHelper.createReader (aISAndBOM.getInputStream (), aISAndBOM.getCharset ())); } // No BOM found - use the returned InputStream anyway, so that the pushed // back bytes are read return read (InputSourceFactory.create (aISAndBOM.getInputStream ())); }
final InputStreamAndCharset aISAndBOM = CharsetHelper.getInputStreamAndCharsetFromBOM (aISOrig);
public void setSourceEncoding (final String sSourceEncoding) { // Throws an exception on an illegal charset CharsetHelper.getCharsetFromName (sSourceEncoding); sourceEncoding = sSourceEncoding; }
/** * @return The charset configured via {@link #ATTR_CHARSET} parameter or the * system default. Never <code>null</code>. */ @Nonnull protected Charset getCharset () { final String sCharsetName = attrs ().getAsString (ATTR_CHARSET); final Charset aCharset = CharsetHelper.getCharsetFromNameOrNull (sCharsetName); return aCharset != null ? aCharset : SystemHelper.getSystemCharset (); }
final InputStreamAndCharset aISC = CharsetHelper.getInputStreamAndCharsetFromBOM (aIS); if (aISC.hasBOM ())
@Nonnull private Charset _getCharset () { final String sRequestEncoding = m_aDelegate.getCharacterEncoding (); return CharsetHelper.getCharsetFromNameOrDefault (sRequestEncoding, StandardCharsets.UTF_8); }
public void setEncoding (@Nullable final String sEncoding) { m_aEncoding = sEncoding == null ? null : CharsetHelper.getCharsetFromName (sEncoding); }
if (sCharsetParam != null) aCharset = CharsetHelper.getCharsetFromNameOrNull (sCharsetParam); if (aCharset == null)
/** * Get the string with the charset defined in the content type. * * @param aFallbackCharset * The fallback charset to be used if the content type does not include * a charset. May not be <code>null</code>. * @return The string representation of the item. */ @Nonnull public String getStringWithFallback (@Nonnull final Charset aFallbackCharset) { final String sCharset = getCharSet (); final Charset aCharset = CharsetHelper.getCharsetFromNameOrDefault (sCharset, aFallbackCharset); return getString (aCharset); }
private void readObject (@Nonnull final ObjectInputStream in) throws IOException, ClassNotFoundException { m_aMimeType = (IMimeType) in.readObject (); m_bBase64Encoded = in.readBoolean (); m_aContent = (byte []) in.readObject (); final String sCharsetName = in.readUTF (); m_aCharset = CharsetHelper.getCharsetFromName (sCharsetName); m_sContent = (String) in.readObject (); }
final Charset aCharset = CharsetHelper.getCharsetFromNameOrNull (sCharset);
final Charset aCharsetToUse = CharsetHelper.getCharsetFromNameOrDefault (m_sHeaderEncoding, SystemHelper.getSystemCharset ()); return aBAOS.getAsString (aCharsetToUse);
public void setCharacterEncoding (@Nullable final String sCharacterEncoding) { setCharacterEncoding (sCharacterEncoding == null ? null : CharsetHelper.getCharsetFromName (sCharacterEncoding)); }
final Charset aCharset = CharsetHelper.getCharsetFromNameOrNull (sCharset);
public void writeStartDocument (@Nonnull final String sEncoding, @Nullable final String sVersion) throws XMLStreamException { writeStartDocument (CharsetHelper.getCharsetFromName (sEncoding), EXMLVersion.getFromVersionOrNull (sVersion)); }
/** * @return The charset defined for this request. May be <code>null</code> if * none is present; */ @Nullable default Charset getCharset () { final String sEncoding = getRequest ().getCharacterEncoding (); return StringHelper.hasNoText (sEncoding) ? null : CharsetHelper.getCharsetFromName (sEncoding); }