SquirrelJME/SquirrelJME

View on GitHub
modules/cldc/src/main/java/java/nio/ByteOrder.java

Summary

Maintainability
A
0 mins
Test Coverage
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the Mozilla Public License Version 2.0.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package java.nio;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.debug.Debugging;

/**
 * This represents the byte order that data may be in.
 *
 * @since 2016/02/27
 */
@Api
public final class ByteOrder
{
    /** Big endian byte order. */
    @Api
    public static final ByteOrder BIG_ENDIAN =
        new ByteOrder("BIG_ENDIAN");
    
    /** Little endian byte order. */
    @Api
    public static final ByteOrder LITTLE_ENDIAN =
        new ByteOrder("LITTLE_ENDIAN");
    
    /** The string representing the byte order. */
    private final String _string;
    
    /**
     * Initializes the byte order.
     *
     * @param __str String pertaining to the order.
     * @throws NullPointerException On null arguments.
     * @since 2016/02/27
     */
    private ByteOrder(String __str)
        throws NullPointerException
    {
        // Check
        if (__str == null)
            throw new NullPointerException();
        
        // Set
        this._string = __str;
    }
    
    /**
     * Returns the string representing the byte order, either
     * {@code BIG_ENDIAN} or {@code LITTLE_ENDIAN}.
     *
     * @return The byte order's string.
     * @since 2016/02/27
     */
    @Override
    public String toString()
    {
        return this._string;
    }
    
    @Api
    public static ByteOrder nativeOrder()
    {
        throw Debugging.todo();
    }
}