org.walluck.oscar
Class AIMInputStream

java.lang.Object
  extended byjava.io.InputStream
      extended byjava.io.FilterInputStream
          extended byjava.io.DataInputStream
              extended byorg.walluck.io.DataInputStreamEx
                  extended byorg.walluck.io.LittleEndianInputStream
                      extended byorg.walluck.oscar.AIMInputStream
All Implemented Interfaces:
java.io.DataInput

public class AIMInputStream
extends LittleEndianInputStream

This does most of the input work.

Since:
1.0
Version:
1.0
Author:
David Walluck
See Also:
LittleEndianInputStream

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
AIMInputStream(java.io.InputStream is)
          Create a new input stream.
 
Method Summary
 int getEmpty()
          Get the number of bytes remaining in this buffer before it becomes empty.
 boolean isEmpty()
          Returns true if this buffer is empty.
 Ad readAd()
          Read an ad from this stream.
 int readCaps(int length)
          Read a non-short capability block from the stream.
 int readCaps(int length, boolean isShort)
          Read a capability block from the stream.
 DirectIMHeader readDirectIMHeader()
          Read a direct IM from this stream.
 FileHeader readFileHeader()
          Read a file header from this stream.
 FLAP readFLAP()
          Read a FLAP from this stream.
 FTTLV readFTTLV()
          Read a file transfer TLV from this stream.
 java.util.ArrayList readGetFileEntries()
          Read a set GetFile entries from this stream.
 GetFileList readGetFileList()
          Read a GetFile listing from this stream.
 ICQColor readICQColor()
          Read an ICQ color from this stream.
 java.lang.String readIP()
          Read an IP from this stream.
 ODirInfo readODirInfo()
          Read an OSCAR directory information class from this stream.
 AIMPopup readPopup()
          Read a popup from this stream.
 ProxyPacket readProxyPacket()
          Read an AOL Proxy Server packet from this stream.
 RateClass readRateClass()
          Read a rate class from this stream.
 Chat readRoomInfo()
          Read room information from this stream.
 SNAC readSNAC()
          Read a SNAC from this stream.
 TLVChain readTLVChain()
          Read a TLV chain from this stream.
 TLVChain readTLVChain(int length)
          Read a TLV chain from this stream of the specified length.
 TLVChain readTLVChainByCount(int count)
          Read a TLV chain from the input stream made up of exactly the specified number of TLV's.
 UserInfo readUserInfo()
          Read a user information class from this stream.
 
Methods inherited from class org.walluck.io.LittleEndianInputStream
readIntLE, readShortLE, readStringLLLE
 
Methods inherited from class org.walluck.io.DataInputStreamEx
readBytes, readString, readString0, readStringL, readStringLL, readStringNullPadded, readStringUntilNull
 
Methods inherited from class java.io.DataInputStream
read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, readUTF, skipBytes
 
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AIMInputStream

public AIMInputStream(java.io.InputStream is)
Create a new input stream.

Parameters:
is - the underlying input stream
Method Detail

readFLAP

public FLAP readFLAP()
              throws java.io.IOException
Read a FLAP from this stream.

Returns:
the newly created FLAP
Throws:
java.io.IOException - if an error occurs

readSNAC

public SNAC readSNAC()
              throws java.io.IOException
Read a SNAC from this stream.

Returns:
the newly created SNAC
Throws:
java.io.IOException - if an error occurs

readTLVChain

public TLVChain readTLVChain(int length)
                      throws java.io.IOException
Read a TLV chain from this stream of the specified length.

Parameters:
length - the length of the TLV chain to read in, in bytes
Returns:
the newly created TLV chain
Throws:
java.io.IOException - if an error occurs

readTLVChain

public TLVChain readTLVChain()
                      throws java.io.IOException
Read a TLV chain from this stream.

Returns:
the newly created TLV chain
Throws:
java.io.IOException - if an error occurs

readTLVChainByCount

public TLVChain readTLVChainByCount(int count)
                             throws java.io.IOException
Read a TLV chain from the input stream made up of exactly the specified number of TLV's.

Parameters:
count - the number of TLV's comprising this TLV chain
Returns:
the newly created TLV chain
Throws:
java.io.IOException - if an error occurs

readFTTLV

public FTTLV readFTTLV()
                throws java.io.IOException
Read a file transfer TLV from this stream.

Returns:
the FTTLV
Throws:
java.io.IOException - if an error occurs

readCaps

public int readCaps(int length,
                    boolean isShort)
             throws java.io.IOException
Read a capability block from the stream. One of the few read methods that actually returns something slightly different than what it reads in.

Parameters:
length - the length of the capability block
isShort - true if this is a short capability block, false otherwise
Returns:
the capability flags
Throws:
java.io.IOException - if an error occurs

readCaps

public int readCaps(int length)
             throws java.io.IOException
Read a non-short capability block from the stream. One of the few read methods that actually returns something slightly different than what it reads in.

Parameters:
length - the length of the capability block
Returns:
the capability flags
Throws:
java.io.IOException - if an error occurs

readUserInfo

public UserInfo readUserInfo()
                      throws java.io.IOException
Read a user information class from this stream.

Returns:
a user information class
Throws:
java.io.IOException - if an error occurs

readODirInfo

public ODirInfo readODirInfo()
                      throws java.io.IOException
Read an OSCAR directory information class from this stream. Currently, we write ODirInfo's out manually because this is a newly discovered feature which hasn't been planned for.

Returns:
an OSCAR directory information class
Throws:
java.io.IOException - if an error occurs

readRoomInfo

public Chat readRoomInfo()
                  throws java.io.IOException
Read room information from this stream.

Returns:
a chat connection which contains this room information
Throws:
java.io.IOException - if an error occurs

readAd

public Ad readAd()
          throws java.io.IOException
Read an ad from this stream.

Returns:
the ad
Throws:
java.io.IOException - if an error occurs

readPopup

public AIMPopup readPopup()
                   throws java.io.IOException
Read a popup from this stream.

Returns:
the popup
Throws:
java.io.IOException - if an error occurs

readRateClass

public RateClass readRateClass()
                        throws java.io.IOException
Read a rate class from this stream.

Returns:
the rate class
Throws:
java.io.IOException - if an error occurs

readDirectIMHeader

public DirectIMHeader readDirectIMHeader()
                                  throws java.io.IOException
Read a direct IM from this stream.

Returns:
the direct IM
Throws:
java.io.IOException - if an error occurs

readFileHeader

public FileHeader readFileHeader()
                          throws java.io.IOException
Read a file header from this stream.

Returns:
the file header
Throws:
java.io.IOException - if an error occurs

readGetFileEntries

public java.util.ArrayList readGetFileEntries()
                                       throws java.io.IOException
Read a set GetFile entries from this stream.

Returns:
the GetFile entries
Throws:
java.io.IOException - if an error occurs

readGetFileList

public GetFileList readGetFileList()
                            throws java.io.IOException
Read a GetFile listing from this stream.

Returns:
the GetFile listing
Throws:
java.io.IOException - if an error occurs

readProxyPacket

public ProxyPacket readProxyPacket()
                            throws java.io.IOException
Read an AOL Proxy Server packet from this stream.

Returns:
the packet
Throws:
java.io.IOException - if an error occurs

readICQColor

public ICQColor readICQColor()
                      throws java.io.IOException
Read an ICQ color from this stream.

Returns:
the ICQ color
Throws:
java.io.IOException - if an error occurs

readIP

public java.lang.String readIP()
                        throws java.io.IOException
Read an IP from this stream.

Returns:
the IP as a "dotted-quad" string
Throws:
java.io.IOException - if an error occurs

getEmpty

public int getEmpty()
             throws java.io.IOException
Get the number of bytes remaining in this buffer before it becomes empty.

Returns:
the number of bytes left in the stream
Throws:
java.io.IOException - if an error occurs

isEmpty

public boolean isEmpty()
                throws java.io.IOException
Returns true if this buffer is empty.

Returns:
true if this buffer is empty, false otherwise
Throws:
java.io.IOException - if an error occurs