38 lines
847 B
Java
38 lines
847 B
Java
package org.hwo.servicelink.ng;
|
|
|
|
import java.io.IOException;
|
|
|
|
import org.hwo.logging.Logging;
|
|
|
|
public abstract class ServiceLinkStream {
|
|
|
|
protected StreamContainer streamContainer;
|
|
|
|
abstract boolean write(ServiceLinkRequestBuffer buffer) throws IOException;
|
|
abstract boolean read(ServiceLinkRequestBuffer buffer) throws IOException;
|
|
|
|
abstract boolean isConnected();
|
|
abstract void close();
|
|
|
|
ServiceLinkRequestBuffer read() {
|
|
ServiceLinkRequestBuffer buffer = ObjectPool.popRequestBuffer();
|
|
try {
|
|
if (read(buffer)) {
|
|
return buffer;
|
|
}
|
|
} catch (Exception e) {
|
|
Logging.log(e);
|
|
}
|
|
ObjectPool.push(buffer);
|
|
return null;
|
|
}
|
|
|
|
public StreamContainer getStreamContainer() {
|
|
return streamContainer;
|
|
}
|
|
public void setStreamContainer(StreamContainer streamContainer) {
|
|
this.streamContainer = streamContainer;
|
|
}
|
|
|
|
}
|