Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 11 java.desktop.jmod - Desktop Module
JDK 11 java.desktop.jmod is the JMOD file for JDK 11 Desktop module.
JDK 11 Desktop module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\java.desktop.jmod.
JDK 11 Desktop module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 Desktop module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\java.desktop.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ javax/imageio/stream/MemoryCacheImageInputStream.java
/*
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package javax.imageio.stream;
import java.io.InputStream;
import java.io.IOException;
import com.sun.imageio.stream.StreamFinalizer;
import sun.java2d.Disposer;
import sun.java2d.DisposerRecord;
/**
* An implementation of {@code ImageInputStream} that gets its
* input from a regular {@code InputStream}. A memory buffer is
* used to cache at least the data between the discard position and
* the current read position.
*
* <p> In general, it is preferable to use a
* {@code FileCacheImageInputStream} when reading from a regular
* {@code InputStream}. This class is provided for cases where
* it is not possible to create a writable temporary file.
*
*/
public class MemoryCacheImageInputStream extends ImageInputStreamImpl {
private InputStream stream;
private MemoryCache cache = new MemoryCache();
/** The referent to be registered with the Disposer. */
private final Object disposerReferent;
/** The DisposerRecord that resets the underlying MemoryCache. */
private final DisposerRecord disposerRecord;
/**
* Constructs a {@code MemoryCacheImageInputStream} that will read
* from a given {@code InputStream}.
*
* @param stream an {@code InputStream} to read from.
*
* @exception IllegalArgumentException if {@code stream} is
* {@code null}.
*/
public MemoryCacheImageInputStream(InputStream stream) {
if (stream == null) {
throw new IllegalArgumentException("stream == null!");
}
this.stream = stream;
disposerRecord = new StreamDisposerRecord(cache);
if (getClass() == MemoryCacheImageInputStream.class) {
disposerReferent = new Object();
Disposer.addRecord(disposerReferent, disposerRecord);
} else {
disposerReferent = new StreamFinalizer(this);
}
}
public int read() throws IOException {
checkClosed();
bitOffset = 0;
long pos = cache.loadFromStream(stream, streamPos+1);
if (pos >= streamPos+1) {
return cache.read(streamPos++);
} else {
return -1;
}
}
public int read(byte[] b, int off, int len) throws IOException {
checkClosed();
if (b == null) {
throw new NullPointerException("b == null!");
}
if (off < 0 || len < 0 || off + len > b.length || off + len < 0) {
throw new IndexOutOfBoundsException
("off < 0 || len < 0 || off+len > b.length || off+len < 0!");
}
bitOffset = 0;
if (len == 0) {
return 0;
}
long pos = cache.loadFromStream(stream, streamPos+len);
len = (int)(pos - streamPos); // In case stream ended early
if (len > 0) {
cache.read(b, off, len, streamPos);
streamPos += len;
return len;
} else {
return -1;
}
}
public void flushBefore(long pos) throws IOException {
super.flushBefore(pos); // this will call checkClosed() for us
cache.disposeBefore(pos);
}
/**
* Returns {@code true} since this
* {@code ImageInputStream} caches data in order to allow
* seeking backwards.
*
* @return {@code true}.
*
* @see #isCachedMemory
* @see #isCachedFile
*/
public boolean isCached() {
return true;
}
/**
* Returns {@code false} since this
* {@code ImageInputStream} does not maintain a file cache.
*
* @return {@code false}.
*
* @see #isCached
* @see #isCachedMemory
*/
public boolean isCachedFile() {
return false;
}
/**
* Returns {@code true} since this
* {@code ImageInputStream} maintains a main memory cache.
*
* @return {@code true}.
*
* @see #isCached
* @see #isCachedFile
*/
public boolean isCachedMemory() {
return true;
}
/**
* Closes this {@code MemoryCacheImageInputStream}, freeing
* the cache. The source {@code InputStream} is not closed.
*/
public void close() throws IOException {
super.close();
disposerRecord.dispose(); // this resets the MemoryCache
stream = null;
cache = null;
}
/**
* {@inheritDoc}
*
* @deprecated The {@code finalize} method has been deprecated.
* Subclasses that override {@code finalize} in order to perform cleanup
* should be modified to use alternative cleanup mechanisms and
* to remove the overriding {@code finalize} method.
* When overriding the {@code finalize} method, its implementation must explicitly
* ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
* See the specification for {@link Object#finalize()} for further
* information about migration options.
*/
@Deprecated(since="9")
protected void finalize() throws Throwable {
// Empty finalizer: for performance reasons we instead use the
// Disposer mechanism for ensuring that the underlying
// MemoryCache is reset prior to garbage collection
}
private static class StreamDisposerRecord implements DisposerRecord {
private MemoryCache cache;
public StreamDisposerRecord(MemoryCache cache) {
this.cache = cache;
}
public synchronized void dispose() {
if (cache != null) {
cache.reset();
cache = null;
}
}
}
}
⏎ javax/imageio/stream/MemoryCacheImageInputStream.java
Or download all of them as a single archive file:
File name: java.desktop-11.0.1-src.zip File size: 7974380 bytes Release date: 2018-11-04 Download
⇒ JDK 11 java.instrument.jmod - Instrument Module
2022-08-06, ≈886🔥, 5💬
Popular Posts:
JDK 17 jdk.incubator.vector.jmo dis the JMOD file for JDK 17 HTTP Server module. JDK 17 Incubator Ve...
maven-embedder-3.8.6.jar is the JAR file for Apache Maven 3.8.6 Embedder module. Apache Maven is a s...
Snappy-Java is a Java port of the "snappy", a fast C++ compresser/decompresser developed by Google. ...
JDK 11 jrt-fs.jar is the JAR file for JDK 11 JRT-FS (Java RunTime - File System) defined in the "jdk...
JDK 17 jdk.charsets.jmod is the JMOD file for JDK 17 Charsets module. JDK 17 Charsets module compile...