1.9.30 sync.
[gae.git] / java / src / main / com / google / appengine / api / socket / AppEngineSocketOutputStream.java
blob727c0adfb036a85ecd1a984e1d63f2b755bf7980
1 // Copyright 2012 Google Inc. All Rights Reserved.
3 package com.google.appengine.api.socket;
5 import java.io.IOException;
6 import java.io.OutputStream;
8 /**
9 * A socket output stream.
12 class AppEngineSocketOutputStream extends OutputStream {
13 final AppEngineSocketImpl socketImpl;
15 AppEngineSocketOutputStream(AppEngineSocketImpl socket) {
16 this.socketImpl = socket;
19 /**
20 * @see java.io.OutputStream#write(int)
22 @Override
23 public void write(int b) throws IOException {
24 byte[] buf = { (byte) b };
25 write(buf, 0, 1);
28 /**
29 * @see java.io.OutputStream#write(byte[], int, int)
31 @Override
32 public void write(byte[] buf, int off, int len) throws IOException {
33 socketImpl.send(buf, off, len);
36 /**
37 * Closes the stream.
39 @Override
40 public void close() throws IOException {
41 socketImpl.close();