<?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.io%2FByteArrayOutputStream</id>
		<title>Java by API/java.io/ByteArrayOutputStream - История изменений</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.io%2FByteArrayOutputStream"/>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_by_API/java.io/ByteArrayOutputStream&amp;action=history"/>
		<updated>2026-04-28T22:23:38Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://jexp.ru/index.php?title=Java_by_API/java.io/ByteArrayOutputStream&amp;diff=1339&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.io/ByteArrayOutputStream&amp;diff=1339&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.io/ByteArrayOutputStream&amp;diff=1340&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.io/ByteArrayOutputStream&amp;diff=1340&amp;oldid=prev"/>
				<updated>2010-05-31T14:32:29Z</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;== ByteArrayOutputStream: toByteArray() ==&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;
import java.io.ByteArrayInputStream;&lt;br /&gt;
import java.io.ByteArrayOutputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String args[]) throws IOException {&lt;br /&gt;
    ByteArrayOutputStream outStream = new ByteArrayOutputStream();&lt;br /&gt;
    String s = &amp;quot;This is a test.&amp;quot;;&lt;br /&gt;
    for (int i = 0; i &amp;lt; s.length(); ++i)&lt;br /&gt;
      outStream.write(s.charAt(i));&lt;br /&gt;
    System.out.println(&amp;quot;outstream: &amp;quot; + outStream);&lt;br /&gt;
    System.out.println(&amp;quot;size: &amp;quot; + outStream.size());&lt;br /&gt;
    ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());&lt;br /&gt;
    int inBytes = inStream.available();&lt;br /&gt;
    System.out.println(&amp;quot;inStream has &amp;quot; + inBytes + &amp;quot; available bytes&amp;quot;);&lt;br /&gt;
    byte inBuf[] = new byte[inBytes];&lt;br /&gt;
    int bytesRead = inStream.read(inBuf, 0, inBytes);&lt;br /&gt;
    System.out.println(bytesRead + &amp;quot; bytes were read&amp;quot;);&lt;br /&gt;
    System.out.println(&amp;quot;They are: &amp;quot; + new String(inBuf));&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;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ByteArrayOutputStream: writeTo(OutputStream out) ==&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;
import java.io.ByteArrayOutputStream;&lt;br /&gt;
import java.io.DataOutputStream;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String args[]) throws IOException {&lt;br /&gt;
    int howMany = 20;&lt;br /&gt;
    // To avoid resizing the buffer, calculate the size of the&lt;br /&gt;
    // byte array in advance.&lt;br /&gt;
    ByteArrayOutputStream bout = new ByteArrayOutputStream(howMany * 4);&lt;br /&gt;
    DataOutputStream dout = new DataOutputStream(bout);&lt;br /&gt;
    for (int i = 0; i &amp;lt;= 20; i++) {&lt;br /&gt;
      dout.writeInt(i);&lt;br /&gt;
    }&lt;br /&gt;
    FileOutputStream fout = new FileOutputStream(&amp;quot;fibonacci.dat&amp;quot;);&lt;br /&gt;
    try {&lt;br /&gt;
      bout.writeTo(fout);&lt;br /&gt;
      fout.flush();&lt;br /&gt;
    } finally {&lt;br /&gt;
      fout.close();&lt;br /&gt;
    }&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;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== new ByteArrayOutputStream(int size) ==&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;
 * Output:&lt;br /&gt;
 *  &lt;br /&gt;
 */&lt;br /&gt;
import java.io.ByteArrayOutputStream;&lt;br /&gt;
import java.io.FileOutputStream;&lt;br /&gt;
import java.io.OutputStream;&lt;br /&gt;
public class MainClass {&lt;br /&gt;
  public static void main(String args[]) throws Exception {&lt;br /&gt;
    ByteArrayOutputStream f = new ByteArrayOutputStream(12);&lt;br /&gt;
    System.out.println(&amp;quot;Please 10 characters and a return&amp;quot;);&lt;br /&gt;
    while (f.size() != 10) {&lt;br /&gt;
      f.write(System.in.read());&lt;br /&gt;
    }&lt;br /&gt;
    System.out.println(&amp;quot;Buffer as a string&amp;quot;);&lt;br /&gt;
    System.out.println(f.toString());&lt;br /&gt;
    System.out.println(&amp;quot;Into array&amp;quot;);&lt;br /&gt;
    byte b[] = f.toByteArray();&lt;br /&gt;
    for (int i = 0; i &amp;lt; b.length; i++) {&lt;br /&gt;
      System.out.print((char) b[i]);&lt;br /&gt;
    }&lt;br /&gt;
    System.out.println();&lt;br /&gt;
    OutputStream f2 = new FileOutputStream(&amp;quot;test.txt&amp;quot;);&lt;br /&gt;
    f.writeTo(f2);&lt;br /&gt;
    f.reset();&lt;br /&gt;
    System.out.println(&amp;quot;10 characters and a return&amp;quot;);&lt;br /&gt;
    while (f.size() != 10) {&lt;br /&gt;
      f.write(System.in.read());&lt;br /&gt;
    }&lt;br /&gt;
    System.out.println(&amp;quot;Done..&amp;quot;);&lt;br /&gt;
  }&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>