PageRenderTime 23ms CodeModel.GetById 13ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/main/java/com/levigo/jbig2/io/DefaultInputStreamFactory.java

http://jbig2-imageio.googlecode.com/
Java | 42 lines | 15 code | 6 blank | 21 comment | 0 complexity | f6abbb48d034fb72a82a23e85e979aae MD5 | raw file
 1/**
 2 * Copyright (C) 1995-2014 levigo holding gmbh.
 3 *
 4 * This program is free software: you can redistribute it and/or modify
 5 * it under the terms of the GNU General Public License as published by
 6 * the Free Software Foundation, either version 3 of the License, or
 7 * (at your option) any later version.
 8 *
 9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18package com.levigo.jbig2.io;
19
20import java.io.IOException;
21import java.io.InputStream;
22
23import javax.imageio.stream.FileCacheImageInputStream;
24import javax.imageio.stream.ImageInputStream;
25import javax.imageio.stream.MemoryCacheImageInputStream;
26
27/**
28 * 
29 * @author <a href="mailto:m.krzikalla@levigo.de">Matth채us Krzikalla</a>
30 * @author Benjamin Zindel
31 */
32public class DefaultInputStreamFactory implements InputStreamFactory {
33
34  public ImageInputStream getInputStream(InputStream is) {
35    try {
36      return new FileCacheImageInputStream(is, null);
37    } catch (IOException e) {
38      return new MemoryCacheImageInputStream(is);
39    }
40  }
41
42}