gnu.mail.util

Class UUEncoderStream


public class UUEncoderStream
extends FilterOutputStream

a stream that performs UU Encoding.

See Also:
java.io.FilterOutputStream

Field Summary

protected int
mode
Permission mode of file.
protected String
name
Name of file to be uuencoded.

Constructor Summary

UUEncoderStream(OutputStream stream)
Create a new UU-Encoding stream with the default name "encoder.buf" with the permission mode 644.
UUEncoderStream(OutputStream stream, String name)
Create a new UU-Encoding stream with the default name permission mode 644.
UUEncoderStream(OutputStream stream, String name, int mode)
Create a new UU-Encoding stream.

Method Summary

void
close()
Close stream.
void
flush()
Flush encoding buffer.
void
setNameMode(String name, int mode)
Set the name and mode for this uu encoded stream.
void
write(byte[] bytes)
Write bytes to stream.
void
write(byte[] bytes, int offset, int length)
Write bytes to encoding stream.
void
write(int b)
Write a byte to the stream.

Field Details

mode

protected int mode
Permission mode of file.


name

protected String name
Name of file to be uuencoded.

Constructor Details

UUEncoderStream

public UUEncoderStream(OutputStream stream)
Create a new UU-Encoding stream with the default name "encoder.buf" with the permission mode 644.

Parameters:
stream - Output stream


UUEncoderStream

public UUEncoderStream(OutputStream stream,
                       String name)
Create a new UU-Encoding stream with the default name permission mode 644.

Parameters:
stream - Output stream
name - File name


UUEncoderStream

public UUEncoderStream(OutputStream stream,
                       String name,
                       int mode)
Create a new UU-Encoding stream.

Parameters:
stream - Output stream
name - File name
mode - File permission mode

Method Details

close

public void close()
            throws IOException
Close stream.


flush

public void flush()
            throws IOException
Flush encoding buffer.


setNameMode

public void setNameMode(String name,
                        int mode)
Set the name and mode for this uu encoded stream. Note that this is only valid before data has been uuencoded as this information is written at the beginning of the stream.

Parameters:
name - File name
mode - Permission mode


write

public void write(byte[] bytes)
            throws IOException
Write bytes to stream.

Parameters:
bytes - Byte array to write to stream


write

public void write(byte[] bytes,
                  int offset,
                  int length)
            throws IOException
Write bytes to encoding stream.

Parameters:
bytes - Byte array to read values from
offset - Offset to start reading bytes from
length - Number of bytes to read


write

public void write(int b)
            throws IOException
Write a byte to the stream.

Parameters:
b - Byte to write to the stream