diff --git a/src/java.base/share/classes/jdk/internal/loader/Resource.java b/src/java.base/share/classes/jdk/internal/loader/Resource.java index b72f4df7d52..312dfc859aa 100644 --- a/src/java.base/share/classes/jdk/internal/loader/Resource.java +++ b/src/java.base/share/classes/jdk/internal/loader/Resource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -33,7 +33,6 @@ import java.security.CodeSigner; import java.util.jar.Manifest; import java.nio.ByteBuffer; import java.util.Arrays; -import sun.nio.ByteBuffered; /** * This class is used to represent a Resource that has been loaded @@ -130,10 +129,6 @@ public abstract class Resource { * @return Resource data or null. */ public ByteBuffer getByteBuffer() throws IOException { - InputStream in = cachedInputStream(); - if (in instanceof ByteBuffered) { - return ((ByteBuffered)in).getByteBuffer(); - } return null; } diff --git a/src/java.base/share/classes/sun/nio/ByteBuffered.java b/src/java.base/share/classes/sun/nio/ByteBuffered.java deleted file mode 100644 index a547cefeb89..00000000000 --- a/src/java.base/share/classes/sun/nio/ByteBuffered.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2003, 2020, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.nio; - -import java.nio.ByteBuffer; -import java.io.IOException; - -/** - * This is an interface to adapt existing APIs to use {@link java.nio.ByteBuffer - * ByteBuffers} as the underlying data format. Only the initial producer and - * final consumer have to be changed. - * - *

- * For example, the Zip/Jar code supports {@link java.io.InputStream InputStreams}. - * To make the Zip code use {@link java.nio.MappedByteBuffer MappedByteBuffers} as - * the underlying data structure, it can create a class of InputStream that wraps - * the ByteBuffer, and implements the ByteBuffered interface. A co-operating class - * several layers away can ask the InputStream if it is an instance of ByteBuffered, - * then call the {@link #getByteBuffer()} method. - */ -public interface ByteBuffered { - - /** - * Returns the {@code ByteBuffer} behind this object, if this particular - * instance has one. An implementation of {@code getByteBuffer()} is allowed - * to return {@code null} for any reason. - * - * @return The {@code ByteBuffer}, if this particular instance has one, - * or {@code null} otherwise. - * - * @throws IOException - * If the ByteBuffer is no longer valid. - * - * @since 1.5 - */ - public ByteBuffer getByteBuffer() throws IOException; -} diff --git a/test/micro/org/openjdk/bench/jdk/internal/jrtfs/ImageReaderBenchmark.java b/test/micro/org/openjdk/bench/jdk/internal/jrtfs/ImageReaderBenchmark.java index 4f97e12171f..1b89b510fae 100644 --- a/test/micro/org/openjdk/bench/jdk/internal/jrtfs/ImageReaderBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/internal/jrtfs/ImageReaderBenchmark.java @@ -1062,7 +1062,6 @@ public class ImageReaderBenchmark { "/modules/java.base/jdk/internal/loader/URLClassPath$FileLoader.class", "/modules/java.base/jdk/internal/loader/Resource.class", "/modules/java.base/java/io/FileCleanable.class", - "/modules/java.base/sun/nio/ByteBuffered.class", "/modules/java.base/java/security/SecureClassLoader$CodeSourceKey.class", "/modules/java.base/java/security/PermissionCollection.class", "/modules/java.base/java/security/Permissions.class",