1 // Copyright 2012 Google Inc. All Rights Reserved.
3 package com
.google
.appengine
.api
.socket
;
5 import java
.io
.IOException
;
6 import java
.io
.InputStream
;
10 class AppEngineSocketInputStream
extends InputStream
{
11 final AppEngineSocketImpl socketImpl
;
13 AppEngineSocketInputStream(AppEngineSocketImpl socketImpl
) {
14 this.socketImpl
= socketImpl
;
18 * @see java.io.InputStream#read()
21 public int read() throws IOException
{
22 byte[] buff
= new byte[1];
23 int count
= read(buff
, 0, 1);
27 return buff
[0] & 0xff;
31 * @see java.io.InputStream#read(byte[], int, int)
34 public int read(byte[] b
, int off
, int len
) throws IOException
{
35 return socketImpl
.receive(b
, off
, len
);
39 * @see java.io.InputStream#available()
42 public int available() throws IOException
{
43 return socketImpl
.available();