Packages
 In this topic

*Constructors

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.io   Previous This
Package
Next

 


Class IntArrayOutputStream

public class IntArrayOutputStream extends java.io.OutputStream
             implements Cloneable
{
  // Constructors
  public IntArrayOutputStream ();
  public IntArrayOutputStream (int size);
  public IntArrayOutputStream (int[] stuff);

  // Methods
  public synchronized void append (int n);
  public synchronized void appendTo (IntArrayOutputStream out);
  public synchronized void appendTo (IntArrayOutputStream out,
        int s, int len);
  public synchronized int capacity ();
  public IntArrayOutputStream copy ();
  public synchronized int copyInto (int[] dest);
  public synchronized int elementAt (int ofs);
  public synchronized int elementFromEnd (int ofs);
  public synchronized int ensureCapacity (int capacity);
  public int[] getIntArray ();
  public synchronized void getInts (int[] dest, int s, int len);
  public synchronized void insertElements (int ofs, int n);
  public boolean isEmpty ();
  public synchronized void putElement (int ofs, int value);
  public synchronized int reduceCapacity (int capacity);
  public synchronized void removeElements (int ofs, int n);
  public void reset ();
  public synchronized void setIntArray (int[] array);
  public synchronized void shrinkToFit ();
  public int size ();
  public synchronized int[] toIntArray ();
  public String toString ();
  public synchronized void truncate (int newsize);
  public void write (int[] src);
  public void write (int b) throws IOException;
  public synchronized void write (int[] src, int s, int len);
}

This class provides methods that create and manipulate output streams for primitive integers.

OutputStream
  |
  +--IntArrayOutputStream

Constructors

IntArrayOutputStream

public IntArrayOutputStream ();

Creates an IntArrayOutputStream object that can hold 16 integers.

IntArrayOutputStream

public IntArrayOutputStream (int size);

Creates an IntArrayOutputStream object that can hold the specified number of integers.

ParameterDescription
size The number of integers that the output stream can hold.

IntArrayOutputStream

public IntArrayOutputStream (int[] stuff);

Creates an IntArrayOutputStream object initialized with integer values.

ParameterDescription
stuff The initial values for the output stream.

Methods

append

public synchronized void append (int n);

Appends an integer to the output stream.

Return Value:

No return value.

ParameterDescription
n The value to append to the output stream.

appendTo

public synchronized void appendTo (IntArrayOutputStream out);

Appends the contents of the output stream onto another IntArrayOutputStream.

Return Value:

No return value.

ParameterDescription
out The output stream to append the stream to.

appendTo

public synchronized void appendTo (IntArrayOutputStream out, int s,
        int len);

Appends integers from this output stream onto another IntArrayOutputStream, beginning at a specified offset in this output stream.

Return Value:

No return value.

ParameterDescription
out The output stream to append the integers to.
s The offset in this output stream where the first integer to append is located.
len The number of integers in this output stream to append.

Exceptions:

ArrayIndexOutOfBoundsException if the offset is negative, or if the specified number of integers to append exceeds the amount available from the specified offset.

capacity

public synchronized int capacity ();

Retrieves the maximum number of integers that the IntArrayOutputStream object can hold.

Return Value:

Returns the maximum capacity of the output stream.

copy

public IntArrayOutputStream copy ();

Creates a deep copy of the output stream.

Return Value:

Returns the copy of the output stream.

copyInto

public synchronized int copyInto (int[] dest);

Copies the contents of the output stream into an array of integers.

Return Value:

Returns the number of elements copied.

ParameterDescription
dest The destination array that the output stream is copied into.

elementAt

public synchronized int elementAt (int ofs);

Retrieves an element from the output stream at a specified offset.

Return Value:

Returns the value of the retrieved element.

ParameterDescription
ofs The offset in the output stream where the element to retrieve is located.

elementFromEnd

public synchronized int elementFromEnd (int ofs);

Retrieves an element from the output stream at a specified offset, relative to the end of the stream.

Return Value:

Returns the value of the retrieved element.

ParameterDescription
ofs The offset from the end of the output stream where the element to retrieve is located.

ensureCapacity

public synchronized int ensureCapacity (int capacity);

Ensures that the IntArrayOutputStream object has enough storage capacity for the specified number of integers. If current capacity exceeds the specified capacity, the current capacity remains unchanged.

Return Value:

Returns the actual capacity of the output stream.

ParameterDescription
capacity The minimum required capacity of the output stream.

getIntArray

public int[] getIntArray ();

Retrieves the array of integers represented by the IntArrayOutputStream object.

Return Value:

Returns the array of integers represented by the output stream.

getInts

public synchronized void getInts (int[] dest, int s, int len);

Copies integers from the output stream to an array. The first integer copied is located at the beginning of the stream; it is copied to the specified offset in the array.

Return Value:

No return value.

ParameterDescription
dest The array that receives the integers.
s The offset in the array where the first integer is copied to.
len The number of integers in the output stream to copy.

Exceptions:

ArrayIndexoutOfBoundsException if the offset is negative, if copying the integers will exceed the capacity of the array, or if the specified number of integers to append exceeds the amount available from the specified offset.

insertElements

public synchronized void insertElements (int ofs, int n);

Inserts zero-initialized elements into the IntArrayOutputStream object.

Return Value:

No return value.

ParameterDescription
ofs The offset in the output stream where the elements are inserted.
n The number of zero-initialized elements to insert.

isEmpty

public boolean isEmpty ();

Determines whether the IntArrayOutputStream object is empty.

Return Value:

Returns true if the output stream is empty; otherwise, returns false.

putElement

public synchronized void putElement (int ofs, int value);

Replaces an element in the output stream at a specified offset.

Return Value:

No return value.

ParameterDescription
ofs The offset in the output stream of the element to be replaced.
value The value for the new element.

Exceptions:

ArrayIndexOutOfBoundsException if the offset exceeds or equals the number of elements currently in the stream.

reduceCapacity

public synchronized int reduceCapacity (int capacity);

Shrinks the storage of the IntArrayOutputStream object to the requested capacity. If the requested capacity is greater than or equal to the capacity of the output stream, the capacity of the output stream remains unchanged.

Return Value:

Returns the actual capacity of the output stream.

ParameterDescription
capacity The maximum required capacity of the output stream.

Exceptions:

ArrayIndexOutOfBoundsException if the number of integers currently in the output stream exceeds the requested capacity.

removeElements

public synchronized void removeElements (int ofs, int n);

Removes elements from the IntArrayOutputStream object.

Return Value:

No return value.

ParameterDescription
ofs The offset in the output stream where the first element to remove is located.
n The number of elements to remove.

reset

public void reset ();

Sets the number of integers in the IntArrayOutputStream object to zero.

Return Value:

No return value.

setIntArray

public synchronized void setIntArray (int[] array);

Sets the values of the IntArrayOutputStream object.

Return Value:

No return value.

ParameterDescription
array The array that contains the new values.

shrinkToFit

public synchronized void shrinkToFit ();

Reduces the capacity of the IntArrayOutputStream object to the number of integers currently in the output stream.

Return Value:

No return value.

size

public int size ();

Retrieves the number of integers in the IntArrayOutputStream object.

Return Value:

Returns the number of integers in the output stream.

toIntArray

public synchronized int[] toIntArray ();

Makes a copy of the array of integers represented by the IntArrayOutputStream object.

Return Value:

Returns a copy of the integers represented by the output stream.

toString

public String toString ();

Converts the output stream to string form.

Return Value:

Returns the output stream in string form.

truncate

public synchronized void truncate (int newsize);

Decreases the number of integers in the IntArrayOutputStream object to the specified number.

Return Value:

No return value.

ParameterDescription
newsize The number of integers that the truncated output stream will hold.

Exceptions:

ArrayIndexOutOfBoundsException if the specified number exceeds or equals the number of integers currently in the output stream.

write

public void write (int[] src);

Appends an array of integers to the output stream.

Return Value:

No return value.

ParameterDescription
src The array of integers to append to the output stream.

write

public void write (int b) throws IOException;

Appends a byte to the output stream. This method blocks until the byte is actually written.

Return Value:

No return value.

ParameterDescription
b The byte to append.

Exceptions:

IOException if the byte cannot be appended to the output stream.

write

public synchronized void write (int[] src, int s, int len);

Appends a number of integers from the specified array to the output stream, starting with the integer at offset s in the array.

Return Value:

No return value.

ParameterDescription
src The array of integers to append to the output stream.
s The offset in the array, where the first integer to append is located.
len The number of integers to append.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.