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

	<entry>
		<id>http://jexp.ru/index.php?title=Java_Tutorial/File/BufferedInputStream&amp;diff=5322&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_Tutorial/File/BufferedInputStream&amp;diff=5322&amp;oldid=prev"/>
				<updated>2010-06-01T05:19:28Z</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/BufferedInputStream&amp;diff=5321&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/BufferedInputStream&amp;diff=5321&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;==  BufferedInputStream ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;For faster reading you should use BufferedInputStream to wrap any InputStream. &lt;br /&gt;
BufferedInputStream has two constructors that accept an InputStream:&amp;lt;/p&amp;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;
public BufferedInputStream(InputStream in)&lt;br /&gt;
public BufferedInput Stream (Input Stream in, int bufferSize)&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;
&amp;lt;p&amp;gt;Then, instead of calling the methods on fis, work with the BufferedInputStream bis.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Buffered 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.BufferedInputStream;&lt;br /&gt;
import java.io.BufferedOutputStream;&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;
    BufferedInputStream bin = new BufferedInputStream(in);&lt;br /&gt;
    BufferedOutputStream bout = new BufferedOutputStream(out);&lt;br /&gt;
    while (true) {&lt;br /&gt;
      int datum = bin.read();&lt;br /&gt;
      if (datum == -1)&lt;br /&gt;
        break;&lt;br /&gt;
      bout.write(datum);&lt;br /&gt;
    }&lt;br /&gt;
    bout.flush();&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;
==  Import a file of exported preference data. ==&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.BufferedInputStream;&lt;br /&gt;
import java.io.FileInputStream;&lt;br /&gt;
import java.io.InputStream;&lt;br /&gt;
import java.util.prefs.Preferences;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] argv) throws Exception {&lt;br /&gt;
    // Create an input stream on a file&lt;br /&gt;
    InputStream is = new BufferedInputStream(new FileInputStream(&amp;quot;output.xml&amp;quot;));&lt;br /&gt;
    // Import preference data&lt;br /&gt;
    Preferences.importPreferences(is);&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;
==  Read File in String Using Java BufferedInputStream Example ==&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.BufferedInputStream;&lt;br /&gt;
import java.io.File;&lt;br /&gt;
import java.io.FileInputStream;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    File file = new File(&amp;quot;C:/ReadFile.txt&amp;quot;);&lt;br /&gt;
    FileInputStream fin = new FileInputStream(file);&lt;br /&gt;
    BufferedInputStream bin = new BufferedInputStream(fin);&lt;br /&gt;
    byte[] contents = new byte[1024];&lt;br /&gt;
    int bytesRead = 0;&lt;br /&gt;
    String strFileContents;&lt;br /&gt;
    while ((bytesRead = bin.read(contents)) != -1) {&lt;br /&gt;
      strFileContents = new String(contents, 0, bytesRead);&lt;br /&gt;
      System.out.print(strFileContents);&lt;br /&gt;
    }&lt;br /&gt;
    bin.close();&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;
==  Read File Using Java BufferedInputStream Example ==&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.BufferedInputStream;&lt;br /&gt;
import java.io.File;&lt;br /&gt;
import java.io.FileInputStream;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    File file = new File(&amp;quot;C:/ReadFile.txt&amp;quot;);&lt;br /&gt;
    FileInputStream fin = new FileInputStream(file);&lt;br /&gt;
    BufferedInputStream bin = new BufferedInputStream(fin);&lt;br /&gt;
    while (bin.available() &amp;gt; 0) {&lt;br /&gt;
      System.out.println((char) bin.read());&lt;br /&gt;
    }&lt;br /&gt;
    bin.close();&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;
==  Read from file with BufferedInputStream ==&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.BufferedInputStream;&lt;br /&gt;
import java.io.FileInputStream;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] args) throws Exception {&lt;br /&gt;
    byte[] buffer = new byte[1024];&lt;br /&gt;
    BufferedInputStream bufferedInput = new BufferedInputStream(new FileInputStream(&amp;quot;filename.txt&amp;quot;));&lt;br /&gt;
    int bytesRead = 0;&lt;br /&gt;
    while ((bytesRead = bufferedInput.read(buffer)) != -1) {&lt;br /&gt;
      String chunk = new String(buffer, 0, bytesRead);&lt;br /&gt;
      System.out.print(chunk);&lt;br /&gt;
    }&lt;br /&gt;
    bufferedInput.close();&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;
==  Save keyboard input with BufferedInputStream ==&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.BufferedInputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
public class ConsoleInput {&lt;br /&gt;
  public static String readLine() {&lt;br /&gt;
    StringBuffer response = new StringBuffer();&lt;br /&gt;
    try {&lt;br /&gt;
      BufferedInputStream buff = new BufferedInputStream(System.in);&lt;br /&gt;
      int in = 0;&lt;br /&gt;
      char inChar;&lt;br /&gt;
      do {&lt;br /&gt;
        in = buff.read();&lt;br /&gt;
        inChar = (char) in;&lt;br /&gt;
        if ((in != -1) &amp;amp; (in != &amp;quot;\n&amp;quot;) &amp;amp; (in != &amp;quot;\r&amp;quot;)) {&lt;br /&gt;
          response.append(inChar);&lt;br /&gt;
        }&lt;br /&gt;
      } while ((in != -1) &amp;amp; (inChar != &amp;quot;\n&amp;quot;) &amp;amp; (in != &amp;quot;\r&amp;quot;));&lt;br /&gt;
      buff.close();&lt;br /&gt;
      return response.toString();&lt;br /&gt;
    } catch (IOException e) {&lt;br /&gt;
      System.out.println(&amp;quot;Exception: &amp;quot; + e.getMessage());&lt;br /&gt;
      return null;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  public static void main(String[] arguments) {&lt;br /&gt;
    System.out.print(&amp;quot;\nWhat is your name? &amp;quot;);&lt;br /&gt;
    String input = ConsoleInput.readLine();&lt;br /&gt;
    System.out.println(&amp;quot;\nHello, &amp;quot; + input);&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;
==  Use buffered streams to copy a file ==&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.BufferedInputStream;&lt;br /&gt;
import java.io.BufferedOutputStream;&lt;br /&gt;
import java.io.FileInputStream;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] argv) throws Exception {&lt;br /&gt;
    BufferedInputStream fin = new BufferedInputStream(new FileInputStream(&amp;quot;in.dat&amp;quot;));&lt;br /&gt;
    BufferedOutputStream fout = new BufferedOutputStream(new FileOutputStream(&amp;quot;out.dat&amp;quot;));&lt;br /&gt;
    int i;&lt;br /&gt;
    do {&lt;br /&gt;
      i = fin.read();&lt;br /&gt;
      if (i != -1)&lt;br /&gt;
        fout.write(i);&lt;br /&gt;
    } while (i != -1);&lt;br /&gt;
    fin.close();&lt;br /&gt;
    fout.close();&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>
			</entry>

	</feed>