class PDDeviceNAttributes
{
    /**
     * Log instance.
     */
    private static final Logger LOG = LogManager.getLogger(PDDeviceNAttributes.class);

    private final COSDictionary dictionary;

    /**
     * Creates a new DeviceN colour space attributes dictionary.
     */
    public PDDeviceNAttributes()
    {
        dictionary = new COSDictionary();
    }

    /**
     * Creates a new DeviceN colour space attributes dictionary from the given dictionary.
     * @param attributes a dictionary that has all of the attributes
     */
    public PDDeviceNAttributes(COSDictionary attributes)
    {
        dictionary = attributes;
    }

    /**
     * Returns the underlying COS dictionary.
     * @return the dictionary that this object wraps
     */
    public COSDictionary getCOSDictionary()
    {
        return dictionary;
    }

    /**
     * Returns a map of colorants and their associated Separation color space.
     * @return map of colorants to color spaces, never null.
     * @throws IOException If there is an error reading a color space
     */
    public Map<String, PDSeparation> getColorants() throws IOException
    {
        Map<String,PDSeparation> actuals = new HashMap<>();
        COSDictionary colorants = dictionary.getCOSDictionary(COSName.COLORANTS);
        if(colorants == null)
        {
            colorants = new COSDictionary();
            dictionary.setItem(COSName.COLORANTS, colorants);
        }
        else
        {
            for (COSName name : colorants.keySet())
            {
                COSBase value = colorants.getDictionaryObject(name);
                actuals.put(name.getName(), (PDSeparation) PDColorSpace.create(value));
            }
        }
        return new COSDictionaryMap<>(actuals, colorants);
    }

    /**
     * Returns the DeviceN Process Dictionary, or null if it is missing.
     * @return the DeviceN Process Dictionary, or null if it is missing.
     */
    public PDDeviceNProcess getProcess()
    {
        COSDictionary process = dictionary.getCOSDictionary(COSName.PROCESS);
        if (process == null)
        {
            return null;
        }
        return new PDDeviceNProcess(process);
    }

    /**
     * Returns true if this is an NChannel (PDF 1.6) color space.
     * @return true if this is an NChannel color space.
     */
    public boolean isNChannel()
    {
        return "NChannel".equals(dictionary.getNameAsString(COSName.SUBTYPE));
    }

    /**
     * Sets the colorant map.
     * @param colorants the map of colorants
     */
    public void setColorants(Map<String, PDColorSpace> colorants)
    {
        COSDictionary colorantDict = null;
        if(colorants != null)
        {
            colorantDict = COSDictionaryMap.convert(colorants);
        }
        dictionary.setItem(COSName.COLORANTS, colorantDict);
    }

    @Override
    public String toString()
    {<FILL_FUNCTION_BODY>}

}

        StringBuilder sb = new StringBuilder(dictionary.getNameAsString(COSName.SUBTYPE));
        sb.append('{');
        PDDeviceNProcess process = getProcess();
        if (process != null)
        {
            sb.append(process);
            sb.append(' ');
        }

        Map<String, PDSeparation> colorants;
        try
        {
            colorants = getColorants();
            sb.append("Colorants{");
            for (Map.Entry<String, PDSeparation> col : colorants.entrySet())
            {
                sb.append('\"');
                sb.append(col.getKey());
                sb.append("\": ");
                sb.append(col.getValue());
                sb.append(' ');
            }
            sb.append('}');
        }
        catch (IOException e)
        {
            LOG.debug("Couldn't get the colorants information - returning 'ERROR' instead'", e);
            sb.append("ERROR");
        }
        sb.append('}');
        return sb.toString();
    
<no_super_class>