<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FFile_Input_Output%2FByteArrayInputStream</id>
		<title>Java/File Input Output/ByteArrayInputStream - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://www.jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java%2FFile_Input_Output%2FByteArrayInputStream"/>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/File_Input_Output/ByteArrayInputStream&amp;action=history"/>
		<updated>2026-04-21T20:06:27Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://www.jexp.ru/index.php?title=Java/File_Input_Output/ByteArrayInputStream&amp;diff=6131&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/File_Input_Output/ByteArrayInputStream&amp;diff=6131&amp;oldid=prev"/>
				<updated>2010-06-01T06:02:32Z</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;Версия 06:02, 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://www.jexp.ru/index.php?title=Java/File_Input_Output/ByteArrayInputStream&amp;diff=6130&amp;oldid=prev</id>
		<title> в 18:01, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://www.jexp.ru/index.php?title=Java/File_Input_Output/ByteArrayInputStream&amp;diff=6130&amp;oldid=prev"/>
				<updated>2010-05-31T18:01:43Z</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;== ByteArrayInputStream Reset ==&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;
import java.io.ByteArrayInputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
class MainClass {&lt;br /&gt;
  public static void main(String args[]) throws IOException {&lt;br /&gt;
    String tmp = &amp;quot;abc&amp;quot;;&lt;br /&gt;
    byte b[] = tmp.getBytes();&lt;br /&gt;
    ByteArrayInputStream in = new ByteArrayInputStream(b);&lt;br /&gt;
    for (int i = 0; i &amp;lt; 2; i++) {&lt;br /&gt;
      int c;&lt;br /&gt;
      while ((c = in.read()) != -1) {&lt;br /&gt;
        if (i == 0) {&lt;br /&gt;
          System.out.print((char) c);&lt;br /&gt;
        } else {&lt;br /&gt;
          System.out.print(Character.toUpperCase((char) c));&lt;br /&gt;
        }&lt;br /&gt;
      }&lt;br /&gt;
      System.out.println();&lt;br /&gt;
      in.reset();&lt;br /&gt;
    }&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;
== Byte Array IO ==&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 ByteArrayIOApp {&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;&lt;br /&gt;
    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;
    &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;
== Convert string into InputStream using ByteArrayInputStream class. ==&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;
import java.io.ByteArrayInputStream;&lt;br /&gt;
import java.io.InputStream;&lt;br /&gt;
public class Main {&lt;br /&gt;
  public static void main(String[] args)throws Exception {&lt;br /&gt;
    String text = &amp;quot;Converting String to InputStream Example&amp;quot;;&lt;br /&gt;
    InputStream is = new ByteArrayInputStream(text.getBytes(&amp;quot;UTF-8&amp;quot;));&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;
== Demonstrate ByteArrayInputStream ==&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;
import java.io.ByteArrayInputStream;&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
class ByteArrayInputStreamDemo {&lt;br /&gt;
  public static void main(String args[]) throws IOException {&lt;br /&gt;
    String tmp = &amp;quot;abcdefghijklmnopqrstuvwxyz&amp;quot;;&lt;br /&gt;
    byte b[] = tmp.getBytes();&lt;br /&gt;
    ByteArrayInputStream input1 = new ByteArrayInputStream(b);&lt;br /&gt;
    ByteArrayInputStream input2 = new ByteArrayInputStream(b, 0, 3);&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;
== Read ByteArrayInputStream to String ==&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;
/*&lt;br /&gt;
 * The contents of this file are subject to the terms &lt;br /&gt;
 * of the Common Development and Distribution License &lt;br /&gt;
 * (the &amp;quot;License&amp;quot;).  You may not use this file except &lt;br /&gt;
 * in compliance with the License.&lt;br /&gt;
 * &lt;br /&gt;
 * You can obtain a copy of the license at &lt;br /&gt;
 * glassfish/bootstrap/legal/CDDLv1.0.txt or &lt;br /&gt;
 * https://glassfish.dev.java.net/public/CDDLv1.0.html. &lt;br /&gt;
 * See the License for the specific language governing &lt;br /&gt;
 * permissions and limitations under the License.&lt;br /&gt;
 * &lt;br /&gt;
 * When distributing Covered Code, include this CDDL &lt;br /&gt;
 * HEADER in each file and include the License file at &lt;br /&gt;
 * glassfish/bootstrap/legal/CDDLv1.0.txt.  If applicable, &lt;br /&gt;
 * add the following below this CDDL HEADER, with the &lt;br /&gt;
 * fields enclosed by brackets &amp;quot;[]&amp;quot; replaced with your &lt;br /&gt;
 * own identifying information: Portions Copyright [yyyy] &lt;br /&gt;
 * [name of copyright owner]&lt;br /&gt;
 */&lt;br /&gt;
/*&lt;br /&gt;
 * @(#)ASCIIUtility.java  1.10 05/08/29&lt;br /&gt;
 *&lt;br /&gt;
 * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.&lt;br /&gt;
 */&lt;br /&gt;
public class Utils {&lt;br /&gt;
  public static String toString(ByteArrayInputStream is) {&lt;br /&gt;
    int size = is.available();&lt;br /&gt;
    char[] theChars = new char[size];&lt;br /&gt;
    byte[] bytes    = new byte[size];&lt;br /&gt;
    is.read(bytes, 0, size);&lt;br /&gt;
    for (int i = 0; i &amp;lt; size;)&lt;br /&gt;
        theChars[i] = (char)(bytes[i++]&amp;amp;0xff);&lt;br /&gt;
    &lt;br /&gt;
    return new String(theChars);&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>
			</entry>

	</feed>