类javax.imageio.stream.FileCacheImageOutputStream源码实例Demo

下面列出了怎么用javax.imageio.stream.FileCacheImageOutputStream的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: openjdk-jdk9   文件: BitPadding.java
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);
    }
}
 
源代码2 项目: jdk8u_jdk   文件: BitPadding.java
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);
    }
}
 
private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException {
	if (this.cacheDir != null) {
		return new FileCacheImageOutputStream(os, this.cacheDir);
	}
	else {
		return new MemoryCacheImageOutputStream(os);
	}
}
 
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();
    }
}
 
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();
    }
}
 
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();
    }
}
 
private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException {
	if (this.cacheDir != null) {
		return new FileCacheImageOutputStream(os, this.cacheDir);
	}
	else {
		return new MemoryCacheImageOutputStream(os);
	}
}
 
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();
    }
}
 
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();
    }
}
 
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();
    }
}
 
源代码11 项目: lams   文件: BufferedImageHttpMessageConverter.java
private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException {
	if (this.cacheDir != null) {
		return new FileCacheImageOutputStream(os, this.cacheDir);
	}
	else {
		return new MemoryCacheImageOutputStream(os);
	}
}
 
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();
    }
}
 
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();
    }
}
 
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();
    }
}
 
源代码15 项目: openjdk-jdk9   文件: FlushBefore.java
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);
}
 
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();
    }
}
 
源代码17 项目: hottub   文件: OutputStreamImageOutputStreamSpi.java
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();
    }
}
 
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();
    }
}
 
private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException {
	if (this.cacheDir != null) {
		return new FileCacheImageOutputStream(os, this.cacheDir);
	}
	else {
		return new MemoryCacheImageOutputStream(os);
	}
}
 
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();
    }
}
 
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();
    }
}
 
源代码22 项目: jdk8u_jdk   文件: FlushBefore.java
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);
}
 
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();
    }
}
 
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();
    }
}
 
 类所在包
 类方法
 同包方法