NetKernel APIs


org.ten60.netkernel.layer1.representation
Class ByteArrayAspect

java.lang.Object
  extended byorg.ten60.netkernel.layer1.representation.ByteArrayAspect
All Implemented Interfaces:
IAspectBinaryStream, IAspectReadableBinaryStream, IURAspect

public class ByteArrayAspect
extends Object
implements IAspectReadableBinaryStream

A byte array implementation of IAspectReadableBinaryStream optimised to work with either ByteArrayOutputStream or a raw array of bytes.


Constructor Summary
ByteArrayAspect(byte[] aBytes)
          Construct a new ByteArrayAspect from a byte[]
ByteArrayAspect(byte[] aBytes, String aEncoding)
          Construct a new ByteArrayAspect from a byte[] with encoding
ByteArrayAspect(ByteArrayOutputStream aBAOS)
          Construct a new ByteArrayAspect from a ByteArrayOutputStream
ByteArrayAspect(ByteArrayOutputStream aBAOS, String aEncoding)
          Construct a new ByteArrayAspect from a ByteArrayOutputStream with encoding
 
Method Summary
static IURRepresentation create(IURMeta aMeta, byte[] aByteArray)
          Deprecated.  
static IURRepresentation create(IURMeta aMeta, byte[] aByteArray, String aEncoding)
          Deprecated.  
static IURRepresentation create(IURMeta aMeta, ByteArrayOutputStream aBAOS)
          Deprecated.  
static IURRepresentation create(IURMeta aMeta, ByteArrayOutputStream aBAOS, String aEncoding)
          Deprecated.  
 int getContentLength()
          returns the number of available bytes to read
 String getEncoding()
           
 InputStream getInputStream()
          return and input stream over the bytes
 void write(OutputStream aStream)
          writes the bytes to the given output stream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArrayAspect

public ByteArrayAspect(ByteArrayOutputStream aBAOS)
Construct a new ByteArrayAspect from a ByteArrayOutputStream


ByteArrayAspect

public ByteArrayAspect(byte[] aBytes)
Construct a new ByteArrayAspect from a byte[]


ByteArrayAspect

public ByteArrayAspect(ByteArrayOutputStream aBAOS,
                       String aEncoding)
Construct a new ByteArrayAspect from a ByteArrayOutputStream with encoding


ByteArrayAspect

public ByteArrayAspect(byte[] aBytes,
                       String aEncoding)
Construct a new ByteArrayAspect from a byte[] with encoding

Method Detail

getContentLength

public int getContentLength()
returns the number of available bytes to read

Specified by:
getContentLength in interface IAspectReadableBinaryStream

getInputStream

public InputStream getInputStream()
                           throws IOException
return and input stream over the bytes

Specified by:
getInputStream in interface IAspectReadableBinaryStream
Throws:
IOException

write

public void write(OutputStream aStream)
           throws IOException
writes the bytes to the given output stream

Specified by:
write in interface IAspectBinaryStream
Parameters:
aStream - the output stream
Throws:
IOException - thrown if we fail to write

create

public static IURRepresentation create(IURMeta aMeta,
                                       ByteArrayOutputStream aBAOS)
Deprecated.  

Creates an IURRepresentation from a ByteArrayOutputStream


create

public static IURRepresentation create(IURMeta aMeta,
                                       byte[] aByteArray)
Deprecated.  

Creates an IURRepresentation from a byte[]


create

public static IURRepresentation create(IURMeta aMeta,
                                       ByteArrayOutputStream aBAOS,
                                       String aEncoding)
Deprecated.  

Creates an IURRepresentation from a ByteArrayOutputStream


create

public static IURRepresentation create(IURMeta aMeta,
                                       byte[] aByteArray,
                                       String aEncoding)
Deprecated.  

Creates an IURRepresentation from a byte[]


getEncoding

public String getEncoding()
Specified by:
getEncoding in interface IAspectBinaryStream

NetKernel APIs


Copyright © 2002-2004 1060 Research Ltd. All Rights Reserved.