2
0

ObjectOutputStream.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 ObjectOutputStream : System.IO.Stream {
  31. readonly java.io.ObjectOutput _javaObjectOutput;
  32. public ObjectOutputStream(java.io.ObjectOutput stream) {
  33. _javaObjectOutput = stream;
  34. }
  35. public override bool CanRead {
  36. get {
  37. return false;
  38. }
  39. }
  40. public override bool CanSeek {
  41. get {
  42. return false;
  43. }
  44. }
  45. public override bool CanWrite {
  46. get {
  47. return true;
  48. }
  49. }
  50. public override void Close() {
  51. _javaObjectOutput.close();
  52. }
  53. public override void Flush() {
  54. _javaObjectOutput.flush();
  55. }
  56. public override long Length {
  57. get {
  58. throw new NotSupportedException();
  59. }
  60. }
  61. public override long Position {
  62. get {
  63. throw new NotSupportedException();
  64. }
  65. set {
  66. throw new NotSupportedException();
  67. }
  68. }
  69. public override long Seek(long offset, System.IO.SeekOrigin origin) {
  70. throw new NotSupportedException();
  71. }
  72. public override void SetLength(long value) {
  73. throw new NotSupportedException();
  74. }
  75. public override int Read(byte[] buffer, int offset, int count) {
  76. throw new NotSupportedException();
  77. }
  78. public override void Write(byte[] buffer, int offset, int count) {
  79. _javaObjectOutput.write( vmw.common.TypeUtils.ToSByteArray(buffer), offset, count );
  80. }
  81. public override void WriteByte(byte value) {
  82. _javaObjectOutput.write(value);
  83. }
  84. public java.io.ObjectOutput NativeStream {
  85. get {return _javaObjectOutput;}
  86. }
  87. }
  88. }