From cowwoc at bbs.darktech.org Wed Jul 1 22:12:05 2009 From: cowwoc at bbs.darktech.org (Gili) Date: Wed, 1 Jul 2009 22:12:05 -0700 (PDT) Subject: AsynchronousCharChannel In-Reply-To: <1245948982400-3156277.post@n2.nabble.com> References: <1245948982400-3156277.post@n2.nabble.com> Message-ID: <1246511525514-3193571.post@n2.nabble.com> As promised, here are two classes for your review: AsynchronousCharChannel and AsynchronousByteCharChannel. 1) I'm looking for a better name than "AsynchronousByteCharChannel" 2) I'd like suggestions on how to clean up the implementation to improve readability and remove duplication. 3) To compile the code, simply replace imports from "jperipheral.nio.channels.*" to "java.nio.channels.*" Please take a look and send me some feedback. Thank you, Gili http://n2.nabble.com/file/n3193571/AsynchronousCharChannel.java AsynchronousCharChannel.java http://n2.nabble.com/file/n3193571/AsynchronousByteCharChannel.java AsynchronousByteCharChannel.java -- View this message in context: http://n2.nabble.com/AsynchronousCharChannel-tp3156277p3193571.html Sent from the nio-discuss mailing list archive at Nabble.com. From Alan.Bateman at Sun.COM Thu Jul 2 06:39:13 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Thu, 02 Jul 2009 14:39:13 +0100 Subject: AsynchronousCharChannel In-Reply-To: <1246511525514-3193571.post@n2.nabble.com> References: <1245948982400-3156277.post@n2.nabble.com> <1246511525514-3193571.post@n2.nabble.com> Message-ID: <4A4CB881.2010005@sun.com> Gili wrote: > As promised, here are two classes for your review: AsynchronousCharChannel > and AsynchronousByteCharChannel. > > 1) I'm looking for a better name than "AsynchronousByteCharChannel" > 2) I'd like suggestions on how to clean up the implementation to improve > readability and remove duplication. > 3) To compile the code, simply replace imports from > "jperipheral.nio.channels.*" to "java.nio.channels.*" > > Please take a look and send me some feedback. > > Thank you, > Gili > > http://n2.nabble.com/file/n3193571/AsynchronousCharChannel.java > AsynchronousCharChannel.java > http://n2.nabble.com/file/n3193571/AsynchronousByteCharChannel.java > AsynchronousByteCharChannel.java > I haven't had a chance to look at this in any detail but I wonder if you really need write(... boolean endOfInput)? That is, do you really need the equivalent of a half-close (as in TCP) or isn't close sufficient? -Alan. From cowwoc at bbs.darktech.org Thu Jul 2 08:44:23 2009 From: cowwoc at bbs.darktech.org (Gili) Date: Thu, 2 Jul 2009 08:44:23 -0700 (PDT) Subject: AsynchronousCharChannel In-Reply-To: <4A4CB881.2010005@sun.com> References: <1245948982400-3156277.post@n2.nabble.com> <1246511525514-3193571.post@n2.nabble.com> <4A4CB881.2010005@sun.com> Message-ID: <1246549463146-3195813.post@n2.nabble.com> Alan Bateman (via Nabble) wrote: > I haven't had a chance to look at this in any detail but I wonder if you > really need write(... boolean endOfInput)? That is, do you really need > the equivalent of a half-close (as in TCP) or isn't close sufficient? Good point. I'll update this in the next release. I'm also looking for a way to use a more generic argument for readLine(). Right now I reference StringBuilder explicitly because: - Passing in CharBuffer (which is Appendable) is questionable because you're likely to run into BufferedOverflowException. - I need to know how many characters were written into the buffer. I can either butcher CharSequenceWriter to expose this information or use something like but the latter wasn't working so cleanly because CharBuffer.length() == CharBuffer.remaining(). Meaning it gets smaller as more data is written to it, whereas StringBuilder.length() gets longer as more data is written to it, so it makes it impossible to use CharSequence.length() consistently to find out how many characters were written. Gili -- View this message in context: http://n2.nabble.com/AsynchronousCharChannel-tp3156277p3195813.html Sent from the nio-discuss mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/nio-discuss/attachments/20090702/6c46e1a4/attachment.html From Alan.Bateman at Sun.COM Thu Jul 2 12:25:52 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Thu, 02 Jul 2009 20:25:52 +0100 Subject: AsynchronousCharChannel In-Reply-To: <1246549463146-3195813.post@n2.nabble.com> References: <1245948982400-3156277.post@n2.nabble.com> <1246511525514-3193571.post@n2.nabble.com> <4A4CB881.2010005@sun.com> <1246549463146-3195813.post@n2.nabble.com> Message-ID: <4A4D09C0.5070506@sun.com> Gili wrote: > : > I'm also looking for a way to use a more generic argument for > readLine(). Right now I reference StringBuilder explicitly because: An alternative is to simply return the line as a String, as in: Future result = channel.readLine(); -Alan. From cowwoc at bbs.darktech.org Thu Jul 2 14:20:17 2009 From: cowwoc at bbs.darktech.org (Gili) Date: Thu, 2 Jul 2009 14:20:17 -0700 (PDT) Subject: AsynchronousCharChannel In-Reply-To: <4A4CB881.2010005@sun.com> References: <1245948982400-3156277.post@n2.nabble.com> <1246511525514-3193571.post@n2.nabble.com> <4A4CB881.2010005@sun.com> Message-ID: <1246569617259-3197865.post@n2.nabble.com> Alan Bateman (via Nabble) wrote: > I haven't had a chance to look at this in any detail but I wonder if you > really need write(... boolean endOfInput)? That is, do you really need > the equivalent of a half-close (as in TCP) or isn't close sufficient? Actually, I just realized... what happens if the last write() triggers a flush() that just so happens to trigger the remote end sending bytes back? If close() means flushes the output, then the receiving end never has a chance of picking up those last incoming bytes. Is this a reasonable use-case? Thanks, Gili -- View this message in context: http://n2.nabble.com/AsynchronousCharChannel-tp3156277p3197865.html Sent from the nio-discuss mailing list archive at Nabble.com. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/nio-discuss/attachments/20090702/02224602/attachment.html From Alan.Bateman at Sun.COM Fri Jul 3 00:59:13 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Fri, 03 Jul 2009 08:59:13 +0100 Subject: AsynchronousCharChannel In-Reply-To: <1246569617259-3197865.post@n2.nabble.com> References: <1245948982400-3156277.post@n2.nabble.com> <1246511525514-3193571.post@n2.nabble.com> <4A4CB881.2010005@sun.com> <1246569617259-3197865.post@n2.nabble.com> Message-ID: <4A4DBA51.9080107@sun.com> Gili wrote: > Alan Bateman (via Nabble) wrote: > > I haven't had a chance to look at this in any detail but I wonder if > you > > really need write(... boolean endOfInput)? That is, do you really need > > the equivalent of a half-close (as in TCP) or isn't close sufficient? > > Actually, I just realized... what happens if the last write() > triggers > a flush() that just so happens to trigger the remote end sending bytes > back? If close() means flushes the output, then the receiving end never > has a chance of picking up those last incoming bytes. Is this a > reasonable use-case? Yep, close is complicated. Your filter will probably need a timer so that if close initiates a write then the timer can be used to close the wrapped channel if the write doesn't complete within a reasonable time. You'll probably need this anyway, even if you have the equivalent of shutdownOutput. Issues such as the peer sending data at around the time that you close the channel are of course possible, and likely indicate a protocol issue. On the "receiving end" attempts to read from the channel will fail with ClosedChannelException (as you would expect). -Alan. From i30817 at gmail.com Tue Jul 28 16:12:48 2009 From: i30817 at gmail.com (Paulo Levi) Date: Wed, 29 Jul 2009 00:12:48 +0100 Subject: Anyway to get the chars that are not valid in filenames Message-ID: <212322090907281612h554846d0t7e192de4a94054d3@mail.gmail.com> In a platform independent manner of course. I sometimes have to convert strings into filenames (and it is important to users to read them yes) and fall afoul of this MSDN Path..::.GetInvalidFileNameChars Method seems like it would work as a windows binding. Anyway in the jdk (1.6) to do this? (and it really should be in the Paths api too). From Alan.Bateman at Sun.COM Wed Jul 29 00:46:16 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Wed, 29 Jul 2009 08:46:16 +0100 Subject: Anyway to get the chars that are not valid in filenames In-Reply-To: <212322090907281612h554846d0t7e192de4a94054d3@mail.gmail.com> References: <212322090907281612h554846d0t7e192de4a94054d3@mail.gmail.com> Message-ID: <4A6FFE48.6070302@sun.com> Paulo Levi wrote: > In a platform independent manner of course. > I sometimes have to convert strings into filenames (and it is > important to users to read them yes) and fall afoul of this > MSDN Path..::.GetInvalidFileNameChars Method seems like it would work > as a windows binding. Anyway in the jdk (1.6) to do this? > (and it really should be in the Paths api too). > That checking is done by the FileSystem#getPath method so you attempt to create a method a Path with invalid path characters or syntax then it throws InvalidPathException. Note that this checking is done at the level of the operating system's definition of paths. You may encounter volumes (or FileStores in this API) that are more restrictive, in which case you will create a Path but perhaps fail when you later go to access the file. -Alan. From martinrb at google.com Wed Jul 29 08:23:19 2009 From: martinrb at google.com (Martin Buchholz) Date: Wed, 29 Jul 2009 08:23:19 -0700 Subject: Anyway to get the chars that are not valid in filenames In-Reply-To: <212322090907281612h554846d0t7e192de4a94054d3@mail.gmail.com> References: <212322090907281612h554846d0t7e192de4a94054d3@mail.gmail.com> Message-ID: <1ccfd1c10907290823pe64df1cja81cd6af3bd9f48b@mail.gmail.com> On Tue, Jul 28, 2009 at 16:12, Paulo Levi wrote: > In a platform independent manner of course. > I sometimes have to convert strings into filenames (and it is > important to users to read them yes) and fall afoul of this > MSDN Path..::.GetInvalidFileNameChars Method seems like it would work > as a windows binding. Anyway in the jdk (1.6) to do this? > (and it really should be in the Paths api too). In the general case, a filesystem could use arbitrary rules for which sequence of characters is a valid file name. The ScrabbleFileSystem might require that every file name is a word from the official Scrabble (TM) dictionary. Martin From i30817 at gmail.com Wed Jul 29 11:42:55 2009 From: i30817 at gmail.com (Paulo Levi) Date: Wed, 29 Jul 2009 19:42:55 +0100 Subject: Anyway to get the chars that are not valid in filenames In-Reply-To: <1ccfd1c10907290823pe64df1cja81cd6af3bd9f48b@mail.gmail.com> References: <212322090907281612h554846d0t7e192de4a94054d3@mail.gmail.com> <1ccfd1c10907290823pe64df1cja81cd6af3bd9f48b@mail.gmail.com> Message-ID: <212322090907291142h27992dbbkb2d1e3de36aef1e5@mail.gmail.com> Yeah, but that is exactly why it would be the responsibility of the platform to bind that. If i have to produce filenames from strings of unchangeable input I'd like to produce something that is not a arbitrary UID. Nevertheless, now i'm using whitelisting - replace by space anything not alphanumeric or "-", "&" and "." in the unicode range (canonical equivalence). On Wed, Jul 29, 2009 at 4:23 PM, Martin Buchholz wrote: > On Tue, Jul 28, 2009 at 16:12, Paulo Levi wrote: >> In a platform independent manner of course. >> I sometimes have to convert strings into filenames (and it is >> important to users to read them yes) and fall afoul of this >> MSDN Path..::.GetInvalidFileNameChars Method seems like it would work >> as a windows binding. Anyway in the jdk (1.6) to do this? >> (and it really should be in the Paths api too). > > In the general case, a filesystem could use arbitrary rules > for which sequence of characters is a valid file name. > The ScrabbleFileSystem might require that every file name > is a word from the official Scrabble (TM) dictionary. > > Martin > From avinash.lakshman at gmail.com Thu Jul 30 08:04:19 2009 From: avinash.lakshman at gmail.com (Avinash Lakshman) Date: Thu, 30 Jul 2009 08:04:19 -0700 Subject: BigByteBuffer Message-ID: Hi All Is this in the horizon? Are there any other projects that provide this feature? It definitely is something that would be a very useful primitive. Cheers Avinash -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.openjdk.java.net/pipermail/nio-discuss/attachments/20090730/e33f89a6/attachment.html From Alan.Bateman at Sun.COM Thu Jul 30 08:18:22 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Thu, 30 Jul 2009 16:18:22 +0100 Subject: BigByteBuffer In-Reply-To: References: Message-ID: <4A71B9BE.70901@sun.com> Avinash Lakshman wrote: > Hi All > > Is this in the horizon? Are there any other projects that provide this > feature? It definitely is something that would be a very useful primitive. > > Cheers > Avinash No, sorry, we didn't take the proposal any further, see: http://mail.openjdk.java.net/pipermail/nio-discuss/2009-June/000207.html So can you tell us how you might use? -Alan. From cowwoc at bbs.darktech.org Fri Jul 31 07:40:28 2009 From: cowwoc at bbs.darktech.org (Gili) Date: Fri, 31 Jul 2009 07:40:28 -0700 (PDT) Subject: AsynchronousByteCharChannel and Timeouts Message-ID: <1249051228626-3363004.post@n2.nabble.com> Hi, Is it possible to move the timeout-related methods out of AsynchronousSocketChannel into their own interface? I want AsynchronousByteCharChannel (character/line reader on top of an AsynchronousByteChannel) to be able to function on top of AsynchronousByteChannels that support timeouts. AsynchronousSocketChannel is one such channel, but so is SerialPortChannel which I've implemented on my end. The methods in question are: void read(ByteBuffer dst, long timeout, TimeUnit unit, A attachment, CompletionHandler handler); void write(ByteBuffer src, long timeout, TimeUnit unit, A attachment, CompletionHandler handler); Thanks, Gili -- View this message in context: http://n2.nabble.com/AsynchronousByteCharChannel-and-Timeouts-tp3363004p3363004.html Sent from the nio-discuss mailing list archive at Nabble.com. From ullenboom at googlemail.com Fri Jul 31 07:35:16 2009 From: ullenboom at googlemail.com (Christian Ullenboom) Date: Fri, 31 Jul 2009 16:35:16 +0200 Subject: DELETE_ON_CLOSE question Message-ID: <426c3b1a0907310735p12f11dc5w91122c2ba25f82f7@mail.gmail.com> The documentation on DELETE_ON_CLOSE makes its clear that this option is just a "best effort attempt to delete the file when closed by the appropriate close method". But I expect somehow that the last exists() return false and not true in the following example: Path path = Paths.get( "opa.herbert.tmp" ); path.deleteIfExists(); System.out.println( path.exists() ); // false path.newOutputStream().close(); System.out.println( path.exists() ); // true path.newOutputStream( StandardOpenOption.DELETE_ON_CLOSE, StandardOpenOption.SYNC ).close(); // File should be gone now, or? System.out.println( path.exists() ); // true I am using jdk-7-ea-bin-b67-windows-i586-30_jul_2009. Thanks Chris From cowwoc at bbs.darktech.org Fri Jul 31 07:46:45 2009 From: cowwoc at bbs.darktech.org (Gili) Date: Fri, 31 Jul 2009 07:46:45 -0700 (PDT) Subject: AsynchronousByteCharChannel and Timeouts In-Reply-To: <1249051228626-3363004.post@n2.nabble.com> References: <1249051228626-3363004.post@n2.nabble.com> Message-ID: <1249051605620-3363044.post@n2.nabble.com> I just defined such an interface. Let me know what you think: http://n2.nabble.com/file/n3363044/AsynchronousByteChannelTimeouts.java AsynchronousByteChannelTimeouts.java Gili Gili wrote: > > Hi, > > Is it possible to move the timeout-related methods out of > AsynchronousSocketChannel into their own interface? I want > AsynchronousByteCharChannel (character/line reader on top of an > AsynchronousByteChannel) to be able to function on top of > AsynchronousByteChannels that support timeouts. AsynchronousSocketChannel > is one such channel, but so is SerialPortChannel which I've implemented on > my end. > > The methods in question are: > > void read(ByteBuffer dst, long timeout, TimeUnit unit, A attachment, > CompletionHandler handler); > void write(ByteBuffer src, long timeout, TimeUnit unit, A attachment, > CompletionHandler handler); > > Thanks, > Gili > -- View this message in context: http://n2.nabble.com/AsynchronousByteCharChannel-and-Timeouts-tp3363004p3363044.html Sent from the nio-discuss mailing list archive at Nabble.com. From Alan.Bateman at Sun.COM Fri Jul 31 08:07:52 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Fri, 31 Jul 2009 16:07:52 +0100 Subject: DELETE_ON_CLOSE question In-Reply-To: <426c3b1a0907310735p12f11dc5w91122c2ba25f82f7@mail.gmail.com> References: <426c3b1a0907310735p12f11dc5w91122c2ba25f82f7@mail.gmail.com> Message-ID: <4A7308C8.5040103@sun.com> Christian Ullenboom wrote: > The documentation on DELETE_ON_CLOSE makes its clear that this option > is just a "best effort attempt to delete the file when closed by the > appropriate close method". But I expect somehow that the last exists() > return false and not true in the following example: > > Path path = Paths.get( "opa.herbert.tmp" ); > path.deleteIfExists(); > System.out.println( path.exists() ); // false > path.newOutputStream().close(); > System.out.println( path.exists() ); // true > path.newOutputStream( StandardOpenOption.DELETE_ON_CLOSE, > StandardOpenOption.SYNC ).close(); > > // File should be gone now, or? > > System.out.println( path.exists() ); // true > > I am using jdk-7-ea-bin-b67-windows-i586-30_jul_2009. > > Thanks > > Chris > This doesn't seem right, assuming that there isn't another thread (or another program on the system) opening that file at around the same time. I just checked this on a couple of systems but didn't duplicate it. As a test, can you put a sleep in before you check if the file exists? Also, which Windows is this and does your virus checker have real-time protection turn on? (we've seen a few cases with virus checkers probing newly created files, I can't of course say if this if this is anything to do it). -Alan. From cowwoc at bbs.darktech.org Fri Jul 31 10:56:58 2009 From: cowwoc at bbs.darktech.org (Gili) Date: Fri, 31 Jul 2009 10:56:58 -0700 (PDT) Subject: AsynchronousByteCharChannel and Timeouts In-Reply-To: <1249051605620-3363044.post@n2.nabble.com> References: <1249051228626-3363004.post@n2.nabble.com> <1249051605620-3363044.post@n2.nabble.com> Message-ID: <1249063018213-3364126.post@n2.nabble.com> Alternatively, we could define these methods in AsynchronousByteChannel and mark them as optional. Subclasses would then document whether they support timeouts or not. This would be a similar design to Collections. I'm still trying to figure out how to design AsynchronousByteCharChannel for AsynchronousByteChannels with timeouts and without. If the timeout methods are optional then the design becomes quite simple. If not, I might have to create two different adapters: one for ByteChannels with timeouts, one for ones without it. Ideas anyone? Gili Gili wrote: > > I just defined such an interface. Let me know what you think: > > http://n2.nabble.com/file/n3363044/AsynchronousByteChannelTimeouts.java > AsynchronousByteChannelTimeouts.java > > Gili > > > Gili wrote: >> >> Hi, >> >> Is it possible to move the timeout-related methods out of >> AsynchronousSocketChannel into their own interface? I want >> AsynchronousByteCharChannel (character/line reader on top of an >> AsynchronousByteChannel) to be able to function on top of >> AsynchronousByteChannels that support timeouts. AsynchronousSocketChannel >> is one such channel, but so is SerialPortChannel which I've implemented >> on my end. >> >> The methods in question are: >> >> void read(ByteBuffer dst, long timeout, TimeUnit unit, A attachment, >> CompletionHandler handler); >> void write(ByteBuffer src, long timeout, TimeUnit unit, A attachment, >> CompletionHandler handler); >> >> Thanks, >> Gili >> > > -- View this message in context: http://n2.nabble.com/AsynchronousByteCharChannel-and-Timeouts-tp3363004p3364126.html Sent from the nio-discuss mailing list archive at Nabble.com. From Alan.Bateman at Sun.COM Fri Jul 31 12:13:19 2009 From: Alan.Bateman at Sun.COM (Alan Bateman) Date: Fri, 31 Jul 2009 20:13:19 +0100 Subject: AsynchronousByteCharChannel and Timeouts In-Reply-To: <1249063018213-3364126.post@n2.nabble.com> References: <1249051228626-3363004.post@n2.nabble.com> <1249051605620-3363044.post@n2.nabble.com> <1249063018213-3364126.post@n2.nabble.com> Message-ID: <4A73424F.3080307@sun.com> Gili wrote: > Alternatively, we could define these methods in AsynchronousByteChannel and > mark them as optional. Subclasses would then document whether they support > timeouts or not. This would be a similar design to Collections. > > I'm still trying to figure out how to design AsynchronousByteCharChannel for > AsynchronousByteChannels with timeouts and without. If the timeout methods > are optional then the design becomes quite simple. If not, I might have to > create two different adapters: one for ByteChannels with timeouts, one for > ones without it. > > Ideas anyone? > > Gili > Another suggestion is to create a class that decorates a given AsynchronousByteChannel, extending it with methods for timed operations. You should be able to combine any AsynchronousByteChannel with the timer support in j.u.c and create a nice solution. -Alan. From cowwoc at bbs.darktech.org Fri Jul 31 15:02:40 2009 From: cowwoc at bbs.darktech.org (Gili) Date: Fri, 31 Jul 2009 15:02:40 -0700 (PDT) Subject: AsynchronousByteCharChannel and Timeouts In-Reply-To: <4A73424F.3080307@sun.com> References: <1249051228626-3363004.post@n2.nabble.com> <1249051605620-3363044.post@n2.nabble.com> <1249063018213-3364126.post@n2.nabble.com> <4A73424F.3080307@sun.com> Message-ID: <1249077760637-3365317.post@n2.nabble.com> Alan Bateman wrote: > > Another suggestion is to create a class that decorates a given > AsynchronousByteChannel, extending it with methods for timed operations. > You should be able to combine any AsynchronousByteChannel with the timer > support in j.u.c and create a nice solution. > > -Alan. > I don't understand. Are you talking about adding functionality similar to Future.get(long timeout) on top of an existing byte channel? I was talking about the different between: read(ByteBuffer dst, A attachment, CompletionHandler handler); and void read(ByteBuffer dst, long timeout, TimeUnit unit, A attachment, CompletionHandler handler); As far as I know you can't implement the latter in terms of the former because you need to pass the timeout values to the underlying OS. What did you mean? Gili -- View this message in context: http://n2.nabble.com/AsynchronousByteCharChannel-and-Timeouts-tp3363004p3365317.html Sent from the nio-discuss mailing list archive at Nabble.com. From cowwoc at bbs.darktech.org Fri Jul 31 17:43:52 2009 From: cowwoc at bbs.darktech.org (Gili) Date: Fri, 31 Jul 2009 17:43:52 -0700 (PDT) Subject: AsynchronousSocketChannel.shutdownInput() Message-ID: <1249087432216-3365782.post@n2.nabble.com> Hi, Just curious, what's the point of shutdownInput() and shutdownOutput() in AsynchronousSocketChannel? When would users want to shut them as opposed to closing the entire channel? Thanks, Gili -- View this message in context: http://n2.nabble.com/AsynchronousSocketChannel.shutdownInput%28%29-tp3365782p3365782.html Sent from the nio-discuss mailing list archive at Nabble.com. From libman at terabit.com.au Fri Jul 31 23:06:48 2009 From: libman at terabit.com.au (Alexander Libman) Date: Sat, 1 Aug 2009 02:06:48 -0400 Subject: AsynchronousSocketChannel.shutdownInput() In-Reply-To: <1249087432216-3365782.post@n2.nabble.com> Message-ID: Hi Gili, shutdownOutput () signals the other side the end of stream So asynch read completed (not failed) with the value of read bytes equal to -1. Example, where shutdownOutput is useful is AsynchoronousSSLChanel (also a filter similar to AsynchronousCoder). Implementation initiates graceful final handshake. I looked at your version of AsynchronousCharByteChannel. BTW, it is another, example where shutdowOutput() can be used instead of method write(CharBuffer source, boolean endOfInput) I think shutdownOutput() provides more consistent interface. Terabit's AsynchronousCoder uses shutdownOutput() for graceful encoding final step. Also there are some cases (not very often) when the closure of external channel (filter itself) should not close the embedded(internal) channel. Assume we want to write AsynchronousSMTPClient. It can be implemented via the following stack of asynch. filters: AsynchronousByteChannel | AsynchronousCharChannel | AsynchronousSMTPChannel AsychronousSMTPChannel "rents" the underline channels to do a SMTP transaction: MailFrom, RcptTo,..., Body After transactions is completed successfully, SMTP channel can be closed, but AsynchronousCharChannel can be reused for the next SMTP transaction. Would you mind to join our effords to facilitate Asynchronous Filter Framework? What do you think about splitting functionality of "Asynchronous Char Line Reader" (i.e. your implementation ) into two filters AsynchronousCoder and AsynchronousScanner? The first one will do only read/write CharBuffers and the second can be generic AsynchronousScanner similar to Scanner? Alex > -----Original Message----- > From: nio-discuss-bounces at openjdk.java.net > [mailto:nio-discuss-bounces at openjdk.java.net]On Behalf Of Gili > Sent: Friday, July 31, 2009 8:44 PM > To: nio-discuss at openjdk.java.net > Subject: AsynchronousSocketChannel.shutdownInput() > > > > Hi, > > Just curious, what's the point of shutdownInput() and shutdownOutput() in > AsynchronousSocketChannel? When would users want to shut them as > opposed to > closing the entire channel? > > Thanks, > Gili > -- > View this message in context: > http://n2.nabble.com/AsynchronousSocketChannel.shutdownInput%28%29 -tp3365782p3365782.html Sent from the nio-discuss mailing list archive at Nabble.com. No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.392 / Virus Database: 270.13.38/2274 - Release Date: 07/31/09 05:58:00