javax.imageio.stream.FileCacheImageOutputStream Java Examples

The following examples show how to use javax.imageio.stream.FileCacheImageOutputStream. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BitPadding.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {
    OutputStream ostream = new ByteArrayOutputStream();
    File f = null;
    FileCacheImageOutputStream fcios =
        new FileCacheImageOutputStream(ostream, f);
    fcios.writeBit(1);
    fcios.write(96);

    fcios.seek(0);
    int r1 = fcios.read();
    if (r1 != 128 ) {
        throw new RuntimeException("Failed, first byte is " + r1);
    }

    int r2 = fcios.read();
    if (r2 != 96) {
        throw new RuntimeException("Failed, second byte is " + r2);
    }
}
 
Example #2
Source File: BitPadding.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {
    OutputStream ostream = new ByteArrayOutputStream();
    File f = null;
    FileCacheImageOutputStream fcios =
        new FileCacheImageOutputStream(ostream, f);
    fcios.writeBit(1);
    fcios.write(96);

    fcios.seek(0);
    int r1 = fcios.read();
    if (r1 != 128 ) {
        throw new RuntimeException("Failed, first byte is " + r1);
    }

    int r2 = fcios.read();
    if (r2 != 96) {
        throw new RuntimeException("Failed, second byte is " + r2);
    }
}
 
Example #3
Source File: FlushBefore.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws IOException {
    OutputStream ostream = new ByteArrayOutputStream();

    FileCacheImageOutputStream fcios =
        new FileCacheImageOutputStream(ostream, null);
    test(fcios);

    MemoryCacheImageOutputStream mcios =
        new MemoryCacheImageOutputStream(ostream);
    test(mcios);
}
 
Example #4
Source File: OutputStreamImageOutputStreamSpi.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #5
Source File: OutputStreamImageOutputStreamSpi.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #6
Source File: FlushBefore.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws IOException {
    OutputStream ostream = new ByteArrayOutputStream();

    FileCacheImageOutputStream fcios =
        new FileCacheImageOutputStream(ostream, null);
    test(fcios);

    MemoryCacheImageOutputStream mcios =
        new MemoryCacheImageOutputStream(ostream);
    test(mcios);
}
 
Example #7
Source File: OutputStreamImageOutputStreamSpi.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #8
Source File: OutputStreamImageOutputStreamSpi.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #9
Source File: BufferedImageHttpMessageConverter.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException {
	if (this.cacheDir != null) {
		return new FileCacheImageOutputStream(os, this.cacheDir);
	}
	else {
		return new MemoryCacheImageOutputStream(os);
	}
}
 
Example #10
Source File: OutputStreamImageOutputStreamSpi.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #11
Source File: OutputStreamImageOutputStreamSpi.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #12
Source File: OutputStreamImageOutputStreamSpi.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #13
Source File: BufferedImageHttpMessageConverter.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException {
	if (this.cacheDir != null) {
		return new FileCacheImageOutputStream(os, this.cacheDir);
	}
	else {
		return new MemoryCacheImageOutputStream(os);
	}
}
 
Example #14
Source File: OutputStreamImageOutputStreamSpi.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #15
Source File: OutputStreamImageOutputStreamSpi.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #16
Source File: OutputStreamImageOutputStreamSpi.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #17
Source File: BufferedImageHttpMessageConverter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException {
	if (this.cacheDir != null) {
		return new FileCacheImageOutputStream(os, this.cacheDir);
	}
	else {
		return new MemoryCacheImageOutputStream(os);
	}
}
 
Example #18
Source File: OutputStreamImageOutputStreamSpi.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #19
Source File: OutputStreamImageOutputStreamSpi.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #20
Source File: OutputStreamImageOutputStreamSpi.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #21
Source File: BufferedImageHttpMessageConverter.java    From java-technology-stack with MIT License 5 votes vote down vote up
private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException {
	if (this.cacheDir != null) {
		return new FileCacheImageOutputStream(os, this.cacheDir);
	}
	else {
		return new MemoryCacheImageOutputStream(os);
	}
}
 
Example #22
Source File: OutputStreamImageOutputStreamSpi.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #23
Source File: OutputStreamImageOutputStreamSpi.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}
 
Example #24
Source File: OutputStreamImageOutputStreamSpi.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public ImageOutputStream createOutputStreamInstance(Object output,
                                                    boolean useCache,
                                                    File cacheDir)
    throws IOException {
    if (output instanceof OutputStream) {
        OutputStream os = (OutputStream)output;
        if (useCache) {
            return new FileCacheImageOutputStream(os, cacheDir);
        } else {
            return new MemoryCacheImageOutputStream(os);
        }
    } else {
        throw new IllegalArgumentException();
    }
}