ObjectInputStream.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. //
  2. // (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
  3. //
  4. // Authors:
  5. // Vladimir Krasnov <[email protected]>
  6. // Konstantin Triger <[email protected]>
  7. //
  8. // Permission is hereby granted, free of charge, to any person obtaining
  9. // a copy of this software and associated documentation files (the
  10. // "Software"), to deal in the Software without restriction, including
  11. // without limitation the rights to use, copy, modify, merge, publish,
  12. // distribute, sublicense, and/or sell copies of the Software, and to
  13. // permit persons to whom the Software is furnished to do so, subject to
  14. // the following conditions:
  15. //
  16. // The above copyright notice and this permission notice shall be
  17. // included in all copies or substantial portions of the Software.
  18. //
  19. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  20. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  22. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  23. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  24. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  25. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  26. //
  27. using System;
  28. namespace System.Web.J2EE
  29. {
  30. internal class ObjectInputStream : System.IO.Stream {
  31. readonly java.io.ObjectInput _javaObjectInput;
  32. public ObjectInputStream(java.io.ObjectInput stream) {
  33. _javaObjectInput = stream;
  34. }
  35. public override bool CanRead {
  36. get {
  37. return true;
  38. }
  39. }
  40. public override bool CanWrite {
  41. get {
  42. return false;
  43. }
  44. }
  45. public override bool CanSeek {
  46. get {
  47. return true;
  48. }
  49. }
  50. public override long Length {
  51. get {
  52. throw new NotSupportedException();
  53. }
  54. }
  55. public override long Position {
  56. get {
  57. throw new NotSupportedException();
  58. }
  59. set {
  60. throw new NotSupportedException();
  61. }
  62. }
  63. public override void Flush() {
  64. throw new NotSupportedException();
  65. }
  66. public override long Seek(long offset, System.IO.SeekOrigin origin) {
  67. if (origin == System.IO.SeekOrigin.Current)
  68. return _javaObjectInput.skip(offset);
  69. throw new NotSupportedException();
  70. }
  71. public override void SetLength(long value) {
  72. throw new NotSupportedException();
  73. }
  74. public override int Read(byte[] buffer, int offset, int count) {
  75. return _javaObjectInput.read(vmw.common.TypeUtils.ToSByteArray(buffer), offset, count);
  76. }
  77. public override void Write(byte[] buffer, int offset, int count) {
  78. throw new NotSupportedException();
  79. }
  80. public override int ReadByte() {
  81. return _javaObjectInput.read();
  82. }
  83. public override void Close() {
  84. _javaObjectInput.close();
  85. }
  86. public java.io.ObjectInput NativeStream {
  87. get {return _javaObjectInput;}
  88. }
  89. }
  90. }