protected JpegReadStatusByte ReadJpegByte() { JpegReadStatusByte status = ReadByte(); if (status.Status == Status.Success) { /* If it's 0xFF, check and discard stuffed zero byte */ if (status.Result == JpegMarker.XFF) { // Discard padded oxFFs while ((status = ReadByte()).Result == 0xff) { ; } // ff00 is the escaped form of 0xff if (status.Result == 0) { status.Result = 0xff; } else { // Otherwise we've found a new marker. status.Status = Status.MarkerFound; return(status); } } status.Status = Status.Success; return(status); } else { return(status); } }
public JpegReadStatusByte ToByte() { var status = new JpegReadStatusByte(); status.Status = Status; status.Result = (byte)Result; return(status); }
public static JpegReadStatusByte GetSuccess() { var status = new JpegReadStatusByte(); status.Status = Status.Success; status.Result = 0; return(status); }
//public byte ReadByte() //{ // int b = _stream.ReadByte(); // if (b == -1) throw new EndOfStreamException(); // return (byte)b; //} public JpegReadStatusByte ReadByte() { var status = new JpegReadStatusByte(); int b = BaseStream.ReadByte(); if (b == -1) { status.Result = 0; status.Status = Status.EOF; } else { status.Result = (byte)b; status.Status = Status.Success; } return(status); }