1 /* Copyright (C) 2004 Versant Inc. http://www.db4o.com */ 2 3 using System.IO; 4 5 namespace Sharpen.IO 6 { 7 public class InputStream : StreamAdaptor, IInputStream 8 { InputStream(Stream stream)9 public InputStream(Stream stream) 10 : base(stream) 11 { 12 } 13 Read()14 public int Read() 15 { 16 return _stream.ReadByte(); 17 } 18 Read(byte[] bytes)19 public int Read(byte[] bytes) 20 { 21 return Read(bytes, 0, bytes.Length); 22 } 23 Read(byte[] bytes, int offset, int length)24 public int Read(byte[] bytes, int offset, int length) 25 { 26 return TranslateReadReturnValue(_stream.Read(bytes, offset, length)); 27 } 28 TranslateReadReturnValue(int read)29 internal static int TranslateReadReturnValue(int read) 30 { 31 return (0 == read) ? -1 : read; 32 } 33 } 34 } 35