}
@Override
public OutputStream getOutputStream() throws IOException {
if (!doOutput) {
throw new ProtocolException(Msg.getString("K008e")); //$NON-NLS-1$
}
// you can't write after you read
if (sentRequest) {
throw new ProtocolException(Msg.getString("K0090")); //$NON-NLS-1$
}
if (os != null) {
return os;
}
// they are requesting a stream to write to. This implies a POST method
if (method == GET) {
method = POST;
}
// If the request method is neither PUT or POST, then you're not writing
if (method != PUT && method != POST) {
throw new ProtocolException(Msg.getString("K008f", method)); //$NON-NLS-1$
}
int limit = -1;
String contentLength = reqHeader.get("Content-Length"); //$NON-NLS-1$
if (contentLength != null) {