SequenceInputStream
java.io.SequenceInputStreamã使ãã¨ãè¤æ°ã®ã¹ããªã¼ã ãé£çµãã¦1ã¤ã®ã¹ããªã¼ã ã¨ãã¦æ±ããã¨ãã§ãã¾ãã
- ã¹ããªã¼ã ãèªã¿ãæå¾ã¾ã§èªã¿è¾¼ãã ã次ã®ã¹ããªã¼ã ãèªã¿ã¾ãã(ãã®ã¨ããèªã¿çµããã¹ããªã¼ã ã¯é 次close()ãããããã§ãã)
- SequenceInputStreamãcloseããã¨ãé£çµããã¹ããªã¼ã ãcloseããã¾ãã
// ã¹ããªã¼ã x2 InputStream a = new ByteArrayInputStream("foo".getBytes()); InputStream b = new ByteArrayInputStream("var".getBytes()); InputStream in = null; try { // SequenceInputStreamã§é£çµ in = new SequenceInputStream (a, b); BufferedReader r = new BufferedReader( new InputStreamReader( in, "UTF-8" )); System.out.println( r.readLine() ); } finally { if ( in != null ) { // SequenceInputStreamãéããã°ã // a,bå ±ã«closeãããã in.close(); } }
å®è¡çµæã§ãã
foovar