<?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_Tutorial%2FFile%2FStream</id>
		<title>Java Tutorial/File/Stream - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_Tutorial%2FFile%2FStream"/>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_Tutorial/File/Stream&amp;action=history"/>
		<updated>2026-04-06T20:21:46Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://jexp.ru/index.php?title=Java_Tutorial/File/Stream&amp;diff=5334&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_Tutorial/File/Stream&amp;diff=5334&amp;oldid=prev"/>
				<updated>2010-06-01T05:19:38Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&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;Версия 05:19, 1 июня 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>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://jexp.ru/index.php?title=Java_Tutorial/File/Stream&amp;diff=5333&amp;oldid=prev</id>
		<title> в 17:44, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_Tutorial/File/Stream&amp;diff=5333&amp;oldid=prev"/>
				<updated>2010-05-31T17:44:27Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==  File copier ==&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;
import java.io.FileInputStream;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.InputStream;&lt;br /&gt;
import java.io.OutputStream;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    if (args.length != 2) {&lt;br /&gt;
      System.err.println(&amp;quot;Usage: java MainClass infile outfile&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    try {&lt;br /&gt;
      copy(args[0], args[1]);&lt;br /&gt;
    } catch (IOException ex) {&lt;br /&gt;
      System.err.println(ex);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public static void copy(String inFile, String outFile) throws IOException {&lt;br /&gt;
    FileInputStream fin = null;&lt;br /&gt;
    FileOutputStream fout = null;&lt;br /&gt;
    try {&lt;br /&gt;
      fin = new FileInputStream(inFile);&lt;br /&gt;
      fout = new FileOutputStream(outFile);&lt;br /&gt;
      copy(fin, fout);&lt;br /&gt;
    } finally {&lt;br /&gt;
      try {&lt;br /&gt;
        if (fin != null)&lt;br /&gt;
          fin.close();&lt;br /&gt;
      } catch (IOException ex) {&lt;br /&gt;
      }&lt;br /&gt;
      try {&lt;br /&gt;
        if (fout != null)&lt;br /&gt;
          fout.close();&lt;br /&gt;
      } catch (IOException ex) {&lt;br /&gt;
      }&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public static void copy(InputStream in, OutputStream out) throws IOException {&lt;br /&gt;
    byte[] buffer = new byte[1024];&lt;br /&gt;
    while (true) {&lt;br /&gt;
      int bytesRead = in.read(buffer);&lt;br /&gt;
      if (bytesRead == -1)&lt;br /&gt;
        break;&lt;br /&gt;
      out.write(buffer, 0, bytesRead);&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;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  File typer ==&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;
import java.io.FileInputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.InputStream;&lt;br /&gt;
import java.io.OutputStream;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws IOException {&lt;br /&gt;
    if (args.length != 1) {&lt;br /&gt;
      System.err.println(&amp;quot;Usage: java FileTyper filename&amp;quot;);&lt;br /&gt;
      return;&lt;br /&gt;
    }&lt;br /&gt;
    typeFile(args[0]);&lt;br /&gt;
  }&lt;br /&gt;
  public static void typeFile(String filename) throws IOException {&lt;br /&gt;
    FileInputStream fin = new FileInputStream(filename);&lt;br /&gt;
    try {&lt;br /&gt;
      copy(fin, System.out);&lt;br /&gt;
    } finally {&lt;br /&gt;
      fin.close();&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public static void copy(InputStream in, OutputStream out) throws IOException {&lt;br /&gt;
    byte[] buffer = new byte[1024];&lt;br /&gt;
    while (true) {&lt;br /&gt;
      int bytesRead = in.read(buffer);&lt;br /&gt;
      if (bytesRead == -1)&lt;br /&gt;
        break;&lt;br /&gt;
      out.write(buffer, 0, bytesRead);&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;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Open Stream from URL ==&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;
import java.net.*;&lt;br /&gt;
import java.io.*;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) throws IOException {&lt;br /&gt;
    InputStream in = null;&lt;br /&gt;
    try {&lt;br /&gt;
      URL u = new URL(&amp;quot;http://www.jexp.ru&amp;quot;);&lt;br /&gt;
      in = u.openStream();&lt;br /&gt;
      for (int c = in.read(); c != -1; c = in.read()) {&lt;br /&gt;
        System.out.write(c);&lt;br /&gt;
      }&lt;br /&gt;
      in.close();&lt;br /&gt;
    } &lt;br /&gt;
    catch (MalformedURLException ex) {&lt;br /&gt;
      System.err.println(&amp;quot;not a URL Java understands.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    finally {&lt;br /&gt;
      if (in != null) in.close();&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;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Stream Copier ==&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;
import java.io.IOException;&lt;br /&gt;
import java.io.InputStream;&lt;br /&gt;
import java.io.OutputStream;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String[] args) {&lt;br /&gt;
    try {&lt;br /&gt;
      copy(System.in, System.out);&lt;br /&gt;
    } catch (IOException ex) {&lt;br /&gt;
      System.err.println(ex);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public static void copy(InputStream in, OutputStream out) throws IOException {&lt;br /&gt;
    byte[] buffer = new byte[1024];&lt;br /&gt;
    while (true) {&lt;br /&gt;
      int bytesRead = in.read(buffer);&lt;br /&gt;
      if (bytesRead == -1)&lt;br /&gt;
        break;&lt;br /&gt;
      out.write(buffer, 0, bytesRead);&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;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Understanding Streams ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;OL&amp;gt;&amp;lt;LI&amp;gt;A stream &amp;quot;is&amp;quot; a sequence of bytes&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;When writing data to a stream, the stream is called an output stream.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;When reading data from a stream, the stream is called an input stream.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;If a stream has a buffer in memory, it is a buffered stream.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Binary Streams contain binary data.&amp;lt;/LI&amp;gt;&amp;lt;LI&amp;gt;Character Streams have character data and are used for storing and retrieving text&amp;lt;/LI&amp;gt;&amp;lt;/OL&amp;gt;&lt;br /&gt;
ClassDescriptionInputStreamThe base class for byte stream input operations.OutputStreamThe base class for byte stream output operations.BufferedInputStreamBuffers input from another stream in memory to make the read operations more efficient.&lt;/div&gt;</summary>
			</entry>

	</feed>