1.0.0

org.eclipse.soda.dk.connection
Class StreamConnection

java.lang.Object
  extended by org.eclipse.soda.dk.core.EscObject
      extended by org.eclipse.soda.dk.connection.Connection
          extended by org.eclipse.soda.dk.connection.StreamConnection
All Implemented Interfaces:
ConnectionService
Direct Known Subclasses:
FileConnection, SerialConnection, TcpipConnection, TcpipServerConnection, UrlConnection

public class StreamConnection
extends Connection
implements ConnectionService

The StreamConnection class implements the ConnectionService interface.

Version:
1.0.0
See Also:
EscObject, ConnectionService

Field Summary
 
Fields inherited from class org.eclipse.soda.dk.connection.Connection
CLIENT_WAIT_RESOURCE, CLOSE_RESOURCE, CLOSED_RESOURCE, configurationService, OPEN_RESOURCE, OPENFAILED_RESOURCE, READ_BYTES_RESOURCE, WRITE_BYTES_RESOURCE
 
Fields inherited from class org.eclipse.soda.dk.core.EscObject
CLONE_EXCEPTION_RESOURCE, EMPTY_BYTES, EMPTY_STRING, ERROR_OCCURRED_EXCEPTION_RESOURCE, ID_FILTER_KEY, ID_KEY, ID_KEY_ANY, INTEGER_TABLE, KEY_KEY, LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_TRACE, LOG_WARNING, PREFIX_KEY, RESOURCE_BUNDLE, SLEEP_EXCEPTION_RESOURCE, SYSTEM_INFO_RESOURCE, TO_STRING_CONFIGURATION_KEYS, TRACE_LEVEL_HIGH, TRACE_LEVEL_LOW, TRACE_LEVEL_MAX, TRACE_LEVEL_MIN, TRACE_LEVEL_NONE, TRACE_LEVEL_NORMAL, TRACELEVEL_KEY, UNKNOWN_ERROR_RESOURCE
 
Fields inherited from interface org.eclipse.soda.dk.connection.service.ConnectionService
CONNECTION_KEY, DEFAULT_CONNECTION, SERVICE_NAME
 
Constructor Summary
StreamConnection()
           
 
Method Summary
 void close()
          Perform the close action method.
 void flush()
          Flush any data to be written.
protected  java.io.InputStream getInputStream()
          Gets the input stream value.
protected  java.io.OutputStream getOutputStream()
          Gets the output stream value.
 int read(byte[] bytes)
          Read bytes.
 int read(byte[] bytes, int offset, int length)
          Read bytes.
 void setInputStream(java.io.InputStream inputStream)
          Sets the input stream value.
 void setOutputStream(java.io.OutputStream outputStream)
          Sets the output stream value.
 void write(byte[] bytes)
          Writes count bytes from the byte array buffer starting at offset.
 void write(byte[] bytes, int offset, int count)
          Writes count bytes from the byte array buffer starting at offset.
 
Methods inherited from class org.eclipse.soda.dk.connection.Connection
attemptRecoveryFromError, exit, finalize, getConfigurationService, getDefaultResource, getErrorSeverity, getResource, isOpen, open, setConfigurationService, setOpen
 
Methods inherited from class org.eclipse.soda.dk.core.EscObject
createDefaultLogService, createException, createException, createInteger, createIntegerTable, createNumber, format, getBoolean, getCurrentTimestamp, getDefaultLogService, getFloat, getInt, getLoadLibraryName, getLogDetails, getLogDetails0, getLogDetails1, getLogDetails2, getLogDetails3, getLogDetails4, getLogDetails5, getLogDetails6, getLogDetails7, getLogService, getLong, getObject, getOutputName, getSimpleClassName, getStaticBoolean, getStaticFloat, getStaticInt, getStaticLong, getStaticObject, getStaticString, getString, getTraceLevel, getVmLibraryVersion, handleError, handleError, handleError, handleStaticError, handleStaticException, isDebug, isTrace, loadService, log, log, report, report, report, report, report, report, reportError, reportSystemInfo, setDebug, setDefaultLogService, setLogService, setTraceLevel, shouldLog, sleep, startupEscStatic, toString, toStringConfigurationKeys, toStringInfo
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.soda.dk.connection.service.ConnectionService
exit, isOpen, open
 

Constructor Detail

StreamConnection

public StreamConnection()
Method Detail

close

public void close()
           throws java.io.IOException
Perform the close action method. href="java.io.IOException.html">IOException Thrown if the IOException exception condition occurs.

Specified by:
close in interface ConnectionService
Overrides:
close in class Connection
Throws:
java.io.IOException
See Also:
ConnectionService.close()

flush

public void flush()
           throws java.io.IOException
Flush any data to be written. If an error occurs attempting to flush this Writer.

Specified by:
flush in interface ConnectionService
Overrides:
flush in class Connection
Throws:
java.io.IOException

getInputStream

protected java.io.InputStream getInputStream()
Gets the input stream value.

Returns:
The input stream (InputStream) value.
See Also:
setInputStream(InputStream)

getOutputStream

protected java.io.OutputStream getOutputStream()
Gets the output stream value.

Returns:
The output stream (OutputStream) value.
See Also:
setOutputStream(OutputStream)

read

public int read(byte[] bytes)
         throws java.io.IOException
Read bytes. the byte array in which to store the read bytes.

Specified by:
read in interface ConnectionService
Overrides:
read in class Connection
Parameters:
bytes - The bytes (byte[]) parameter.
Returns:
the number of bytes actually read or -1 if end of stream. If the stream is already closed or another IOException occurs.
Throws:
java.io.IOException
See Also:
read(byte[],int,int)

read

public int read(byte[] bytes,
                int offset,
                int length)
         throws java.io.IOException
Read bytes. the byte array in which to store the read bytes. the offset in b to store the read bytes. the maximum number of bytes to store in b.

Specified by:
read in interface ConnectionService
Parameters:
bytes - The bytes (byte[]) parameter.
offset - The offset (int) parameter.
length - The length (int) parameter.
Returns:
the number of bytes actually read or -1 if end of stream. If the stream is already closed or another IOException occurs.
Throws:
java.io.IOException
See Also:
read(byte[])

setInputStream

public void setInputStream(java.io.InputStream inputStream)
Sets the input stream value. The input stream (InputStream) parameter.

Parameters:
inputStream - The input stream (InputStream) parameter.
See Also:
getInputStream()

setOutputStream

public void setOutputStream(java.io.OutputStream outputStream)
Sets the output stream value. The output stream (OutputStream) parameter.

Parameters:
outputStream - The output stream (OutputStream) parameter.
See Also:
getOutputStream()

write

public void write(byte[] bytes)
           throws java.io.IOException
Writes count bytes from the byte array buffer starting at offset. the buffer to be written an error occurs attempting to write to this OutputStream. If offset or count are outside of bounds.

Specified by:
write in interface ConnectionService
Overrides:
write in class Connection
Parameters:
bytes - The bytes (byte[]) parameter.
Throws:
java.io.IOException
See Also:
write(byte[],int,int)

write

public void write(byte[] bytes,
                  int offset,
                  int count)
           throws java.io.IOException
Writes count bytes from the byte array buffer starting at offset. the buffer to be written offset in buffer to get bytes number of bytes in buffer to write an error occurs attempting to write to this OutputStream. If offset or count are outside of bounds.

Specified by:
write in interface ConnectionService
Parameters:
bytes - The bytes (byte[]) parameter.
offset - The offset (int) parameter.
count - The count (int) parameter.
Throws:
java.io.IOException
See Also:
write(byte[])

1.0.0

Copyright (c) 1999, 2007 IBM