Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 9 additions & 32 deletions src/java.base/share/classes/java/nio/ByteOrder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -35,28 +35,19 @@
* @since 1.4
*/

public final class ByteOrder {

private final String name;

private ByteOrder(String name) {
this.name = name;
}

/**
* Constant denoting big-endian byte order. In this order, the bytes of a
* multibyte value are ordered from most significant to least significant.
*/
public static final ByteOrder BIG_ENDIAN
= new ByteOrder("BIG_ENDIAN");

public enum ByteOrder {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public enum ByteOrder {
public enum ByteOrder {

/**
* Constant denoting little-endian byte order. In this order, the bytes of
* a multibyte value are ordered from least significant to most
* significant.
*/
public static final ByteOrder LITTLE_ENDIAN
= new ByteOrder("LITTLE_ENDIAN");
LITTLE_ENDIAN,
/**
Comment on lines +44 to +45
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LITTLE_ENDIAN,
/**
LITTLE_ENDIAN,
/**

* Constant denoting big-endian byte order. In this order, the bytes of a
* multibyte value are ordered from most significant to least significant.
*/
BIG_ENDIAN;


// Retrieve the native byte order. It's used early during bootstrap, and
// must be initialized after BIG_ENDIAN and LITTLE_ENDIAN.
Expand All @@ -78,18 +69,4 @@ private ByteOrder(String name) {
public static ByteOrder nativeOrder() {
return NATIVE_ORDER;
}

/**
* Constructs a string describing this object.
*
* <p> This method returns the string
* {@code "BIG_ENDIAN"} for {@link #BIG_ENDIAN} and
* {@code "LITTLE_ENDIAN"} for {@link #LITTLE_ENDIAN}.
*
* @return The specified string
*/
public String toString() {
return name;
}

}