1 23 package com.sun.enterprise.web.connector.grizzly; 24 25 import java.io.IOException ; 26 import java.io.InputStream ; 27 import java.io.OutputStream ; 28 29 import java.nio.ByteBuffer ; 30 31 32 38 public class TaskContext{ 39 40 41 44 private InputStream inputStream; 45 46 47 50 private ByteBufferStream outputStream; 51 52 53 55 58 public TaskContext(){ 59 } 60 61 62 64 65 69 public InputStream getInputStream(){ 70 return inputStream; 71 } 72 73 public OutputStream getOutputStream(){ 74 return (OutputStream )outputStream; 75 } 76 77 public void setInputStream(InputStream inputStream){ 78 this.inputStream = inputStream; 79 } 80 81 public void setOutputStream(ByteBufferStream outputStream){ 82 this.outputStream = outputStream; 83 } 84 85 87 88 91 public void write(ByteBuffer byteBuffer) throws IOException { 92 outputStream.write(byteBuffer); 93 } 94 95 96 99 public void flush() throws IOException { 100 if (outputStream != null) { 101 outputStream.flush(); 102 } 103 } 104 105 106 109 public void recycle() throws IOException { 110 if (inputStream != null){ 111 flush(); 112 inputStream.close(); 113 } 114 } 115 116 } 117 118 119 120 121 122 | Popular Tags |