public ByteArrayDataSource()

in src/main/java/org/apache/commons/mail/ByteArrayDataSource.java [104:129]


    public ByteArrayDataSource(final String data, final String aType) throws IOException
    {
        this.type = aType;

        try
        {
            baos = new ByteArrayOutputStream();

            // Assumption that the string contains only ASCII characters!
            // Else just pass in a charset into this constructor and use it in getBytes().
            baos.write(data.getBytes(StandardCharsets.ISO_8859_1));
            baos.flush();
            baos.close();
        }
        catch (final UnsupportedEncodingException uex)
        {
            throw new IOException("The Character Encoding is not supported.");
        }
        finally
        {
            if (baos != null)
            {
                baos.close();
            }
        }
    }