Secure iNet Factory

com.jscape.inet.util
Class YEnc

java.lang.Object
  extended by com.jscape.inet.util.YEnc
All Implemented Interfaces:
Codec

public class YEnc
extends java.lang.Object
implements Codec

Implements methods for encoding and decoding data using the YEnc specification.


Constructor Summary
YEnc()
          Creates a new YEnc instance.
YEnc(int maxLineLength)
          Creates a new YEnc instance.
 
Method Summary
 byte[] decode(char[] values)
          Decodes data encoded in YEnc format.
 char[] encode(byte[] values)
          Encodes data in YEnc format.
 char[] encode(byte[] values, java.lang.String name)
          Encodes data in YEnc format.
 long getBegin()
          Gets begin attribute of
 long getEnd()
           
 java.lang.String getFileName()
           
 long getLineLength()
           
 int getMaxLineLength()
          Gets maximum line length used when encoding data.
 long getSize()
           
 void setMaxLineLength(int l)
          Sets maximum line length used when encoding data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YEnc

public YEnc()
Creates a new YEnc instance.


YEnc

public YEnc(int maxLineLength)
Creates a new YEnc instance.

Parameters:
maxLineLength - the maximum line length to use when encoding data, default is 128.
Method Detail

decode

public byte[] decode(char[] values)
              throws java.lang.Exception
Decodes data encoded in YEnc format. Each part in a multi-part YEnc message must be decoded separately.

Specified by:
decode in interface Codec
Parameters:
values - the encoded data to decode
Returns:
the decoded data
Throws:
java.lang.Exception - if an error occurs while decoding data

encode

public char[] encode(byte[] values)
Encodes data in YEnc format. The name attribute of YEnc header is set to "unknown".

Specified by:
encode in interface Codec
Parameters:
values - the data to encode
Returns:
the data to encode

encode

public char[] encode(byte[] values,
                     java.lang.String name)
Encodes data in YEnc format.

Parameters:
values - the data to encode
name - the value to be used in name attribute of YEnc header, typically the filename.
Returns:
the data to encode

getMaxLineLength

public int getMaxLineLength()
Gets maximum line length used when encoding data. Default line length is 128.

Returns:
the maximum line length

setMaxLineLength

public void setMaxLineLength(int l)
Sets maximum line length used when encoding data. Default line length is 128.

Parameters:
l - the maximum line length;

getBegin

public long getBegin()
Gets begin attribute of

Returns:
begin long value

getEnd

public long getEnd()
Returns:
end long value

getLineLength

public long getLineLength()
Returns:
line length

getFileName

public java.lang.String getFileName()
Returns:
filename

getSize

public long getSize()
Returns:
size long value

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved