<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_by_API%2Fjava.nio.channels%2FReadableByteChannel</id>
		<title>Java by API/java.nio.channels/ReadableByteChannel - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_by_API%2Fjava.nio.channels%2FReadableByteChannel"/>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_by_API/java.nio.channels/ReadableByteChannel&amp;action=history"/>
		<updated>2026-04-15T03:03:21Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://jexp.ru/index.php?title=Java_by_API/java.nio.channels/ReadableByteChannel&amp;diff=24&amp;oldid=prev</id>
		<title> в 17:43, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_by_API/java.nio.channels/ReadableByteChannel&amp;diff=24&amp;oldid=prev"/>
				<updated>2010-05-31T17:43:48Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 17:43, 31 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://jexp.ru/index.php?title=Java_by_API/java.nio.channels/ReadableByteChannel&amp;diff=25&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_by_API/java.nio.channels/ReadableByteChannel&amp;diff=25&amp;oldid=prev"/>
				<updated>2010-05-31T14:09:59Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== ReadableByteChannel: read(ByteBuffer dst) ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright (c) 2004 David Flanagan.  All rights reserved.&lt;br /&gt;
 * This code is from the book Java Examples in a Nutshell, 3nd Edition.&lt;br /&gt;
 * It is provided AS-IS, WITHOUT ANY WARRANTY either expressed or implied.&lt;br /&gt;
 * You may study, use, and modify it for any non-commercial purpose,&lt;br /&gt;
 * including teaching and use in open-source projects.&lt;br /&gt;
 * You may distribute it non-commercially as long as you retain this notice.&lt;br /&gt;
 * For a commercial use license, or to purchase the book, &lt;br /&gt;
 * please visit http://www.davidflanagan.ru/javaexamples3.&lt;br /&gt;
 */&lt;br /&gt;
//package je3.nio;&lt;br /&gt;
import java.io.FileInputStream;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.nio.ByteBuffer;&lt;br /&gt;
import java.nio.channels.Channels;&lt;br /&gt;
import java.nio.channels.ReadableByteChannel;&lt;br /&gt;
import java.nio.channels.WritableByteChannel;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] args) throws IOException {&lt;br /&gt;
    // Open file streams and get channels for them.&lt;br /&gt;
    ReadableByteChannel in = new FileInputStream(args[0]).getChannel();&lt;br /&gt;
    WritableByteChannel out;&lt;br /&gt;
    if (args.length &amp;gt; 1)&lt;br /&gt;
      out = new FileOutputStream(args[1]).getChannel();&lt;br /&gt;
    else&lt;br /&gt;
      out = Channels.newChannel(System.out);&lt;br /&gt;
    // Do the copy&lt;br /&gt;
    copy(in, out);&lt;br /&gt;
    // Exception handling and stream-closing code has been omitted.&lt;br /&gt;
  }&lt;br /&gt;
  // Read all available bytes from one channel and copy them to the other.&lt;br /&gt;
  public static void copy(ReadableByteChannel in, WritableByteChannel out) throws IOException {&lt;br /&gt;
    // First, we need a buffer to hold blocks of copied bytes.&lt;br /&gt;
    ByteBuffer buffer = ByteBuffer.allocateDirect(32 * 1024);&lt;br /&gt;
    // Now loop until no more bytes to read and the buffer is empty&lt;br /&gt;
    while (in.read(buffer) != -1 || buffer.position() &amp;gt; 0) {&lt;br /&gt;
      // The read() call leaves the buffer in &amp;quot;fill mode&amp;quot;. To prepare&lt;br /&gt;
      // to write bytes from the bufferwe have to put it in &amp;quot;drain mode&amp;quot;&lt;br /&gt;
      // by flipping it: setting limit to position and position to zero&lt;br /&gt;
      buffer.flip();&lt;br /&gt;
      // Now write some or all of the bytes out to the output channel&lt;br /&gt;
      out.write(buffer);&lt;br /&gt;
      // Compact the buffer by discarding bytes that were written,&lt;br /&gt;
      // and shifting any remaining bytes. This method also&lt;br /&gt;
      // prepares the buffer for the next call to read() by setting the&lt;br /&gt;
      // position to the limit and the limit to the buffer capacity.&lt;br /&gt;
      buffer.rupact();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>