| 1 |
/** |
| 2 |
* Copyright (c) 2010 Ed Merks and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v2.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v20.html |
| 7 |
* |
| 8 |
* Contributors: |
| 9 |
* Ed Merks - Initial API and implementation |
| 10 |
*/ |
| 11 |
package java.io; |
| 12 |
|
| 13 |
import java.io.IOException; |
| 14 |
|
| 15 |
public abstract class InputStream |
| 16 |
{ |
| 17 |
public int available() throws IOException |
| 18 |
{ |
| 19 |
return 0; |
| 20 |
} |
| 21 |
|
| 22 |
public abstract int read() throws IOException; |
| 23 |
|
| 24 |
public int read(byte[] bytes, int start, int length) throws IOException |
| 25 |
{ |
| 26 |
for (int i = 0; i < length; ++i) |
| 27 |
{ |
| 28 |
int value = read(); |
| 29 |
if (value == -1) |
| 30 |
{ |
| 31 |
return i == 0 ? -1 : i; |
| 32 |
} |
| 33 |
bytes[i] = (byte)value; |
| 34 |
} |
| 35 |
return length; |
| 36 |
} |
| 37 |
|
| 38 |
public int read(byte[] bytes) throws IOException |
| 39 |
{ |
| 40 |
return read(bytes, 0, bytes.length); |
| 41 |
} |
| 42 |
|
| 43 |
public boolean markSupported() |
| 44 |
{ |
| 45 |
return false; |
| 46 |
} |
| 47 |
|
| 48 |
public void reset() throws IOException |
| 49 |
{ |
| 50 |
// |
| 51 |
} |
| 52 |
|
| 53 |
public void mark(int mark) |
| 54 |
{ |
| 55 |
// |
| 56 |
} |
| 57 |
|
| 58 |
public void close() throws IOException |
| 59 |
{ |
| 60 |
// |
| 61 |
} |
| 62 |
} |