NAME
Java::IO::InputStream - Base class for Reading Java formatted streams
AUTHOR
Sal Scotto sscotto@cpan.org
REQUIRES
Perl 5.005 or greater, IO::Handle
SYNOPSIS
use Java::IO::InputStream;
my $socketHandle;
# .. socket creation code
my $stream = Java::IO::InputStream($socketHandle);
my $javaLong = $stream->readLong;
my $javaString = $stream->readUTF8;
...
ABSTRACT
Base class for manipulating java io streams from Perl.
DESCRIPTION
This class represents a base class for reading java based streams. It's intended use is to be extended for things like a perl based java object de-serializer, reading java class files, etc.. The methods available are similar to the methods of java's datainputstream.
This class can perform all the correct decoding of java formatted data and can be used as a bridge for your perl application to speak to a java application over a socket, or read a file written using java's dataoutputstream.
It is probably important to at least have briefly read "The JavaTM Language Specification", http://java.sun.com/docs/books/jls/
METHODS
new
This is the constructor it wraps am IO::Handle object
my $stream = Java::IO::InputStream($handle);
read
Note: All the read methods will return -1 if the stream at EOF
This method reads a single byte from the stream.
my $byte = $stream->read;
close
This method will close the stream
$stream->close();
skipBytes
This method will skip X bytes in the stream and return the amount successfully skipped.
my $skipped = $stream->skipBytes(20);
readByte
This methods reads a single signed byte from the stream.
(Note: this method added for completness and sinply wraps read)
my $byte = $stream->readByte;
readUnsignedByte
This method reads a single unsigned byte from the stream
my $ubyte = $stream->readUnsignedByte;
readBoolean
This method reads a boolean value from the stream
my $boolean = $stream->readBoolean;
readShort
This method read a short value from the stream
my $short = $stream->readShort;
readUnsginedShort
This method read an unsigned short value from the stream
my $ushort = $stream->readUnsignedShort;
readInt
This method read an int value from the stream
my $int = $stream->readInt;
readUnsignedInt
This method read an unsigned int value from the stream
my $uint = $stream->readUnsignedInt;
readLong
This method read a long value from the stream
my $long = $stream->readLong;
readUnsignedLong
This method read an unsigned long value from the stream
my $ulong = $stream->readUnsignedLong;
readUTF8
This method read an UTF8 encoded string from the stream
my $string = $stream->readUTF8;
readUTF16
This method read an UTF16 encoded string from the stream
my $string = $stream->readUTF16;
readUTF
This method read an UTF encoded string from the stream
my $string = $stream->readUTF([LONG]);
LONG should be set to true if this is an UTF16 string
COPYRIGHT
Copyright (c) 2002 Sal Scotto (sscotto@cpan.org). All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.