jstream.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef JSTREAM_HPP
  14. #define JSTREAM_HPP
  15. #include "jiface.hpp"
  16. class StringBuffer;
  17. interface jlib_decl IByteOutputStream : public IInterface
  18. {
  19. virtual void writeByte(byte b) = 0;
  20. virtual void writeBytes(const void *, int) = 0;
  21. virtual void writeString(const char *str) = 0;
  22. };
  23. interface jlib_decl IByteInputStream : public IInterface
  24. {
  25. virtual bool eof() = 0;
  26. virtual int readByte() = 0;
  27. virtual int readBytes(void *buf, int size) = 0;
  28. virtual void unget(int c) = 0;
  29. };
  30. extern jlib_decl IByteInputStream *createInputStream(const char *string);
  31. extern jlib_decl IByteInputStream *createInputStream(StringBuffer &from);
  32. extern jlib_decl IByteInputStream *createInputStream(int handle);
  33. extern jlib_decl IByteOutputStream *createOutputStream(StringBuffer &to);
  34. extern jlib_decl IByteOutputStream *createOutputStream(int handle);
  35. #endif