< prev index next >

jdk/src/jdk.jline/share/classes/jdk/internal/jline/internal/NonBlockingInputStream.java

Print this page


   1 /*
   2  * Copyright (c) 2002-2012, the original author or authors.
   3  *
   4  * This software is distributable under the BSD license. See the terms of the
   5  * BSD license in the documentation provided with this software.
   6  *
   7  * http://www.opensource.org/licenses/bsd-license.php
   8  */
   9 package jline.internal;
  10 
  11 import java.io.IOException;
  12 import java.io.InputStream;
  13 
  14 /**
  15  * This class wraps a regular input stream and allows it to appear as if it
  16  * is non-blocking; that is, reads can be performed against it that timeout
  17  * if no data is seen for a period of time.  This effect is achieved by having
  18  * a separate thread perform all non-blocking read requests and then
  19  * waiting on the thread to complete.  
  20  * 
  21  * <p>VERY IMPORTANT NOTES
  22  * <ul>
  23  *   <li> This class is not thread safe. It expects at most one reader.
  24  *   <li> The {@link #shutdown()} method must be called in order to shut down
  25  *          the thread that handles blocking I/O.
  26  * </ul>
  27  * @since 2.7
  28  * @author Scott C. Gray <scottgray1@gmail.com>
  29  */


   1 /*
   2  * Copyright (c) 2002-2012, the original author or authors.
   3  *
   4  * This software is distributable under the BSD license. See the terms of the
   5  * BSD license in the documentation provided with this software.
   6  *
   7  * http://www.opensource.org/licenses/bsd-license.php
   8  */
   9 package jdk.internal.jline.internal;
  10 
  11 import java.io.IOException;
  12 import java.io.InputStream;
  13 
  14 /**
  15  * This class wraps a regular input stream and allows it to appear as if it
  16  * is non-blocking; that is, reads can be performed against it that timeout
  17  * if no data is seen for a period of time.  This effect is achieved by having
  18  * a separate thread perform all non-blocking read requests and then
  19  * waiting on the thread to complete.
  20  *
  21  * <p>VERY IMPORTANT NOTES
  22  * <ul>
  23  *   <li> This class is not thread safe. It expects at most one reader.
  24  *   <li> The {@link #shutdown()} method must be called in order to shut down
  25  *          the thread that handles blocking I/O.
  26  * </ul>
  27  * @since 2.7
  28  * @author Scott C. Gray <scottgray1@gmail.com>
  29  */


< prev index next >