Artifact 1921fa4c5595760bf3438792378b52cb8f16489a3b08bce0c57f7c98f37726de:
- File
src/OFStream.h
— part of check-in
[70874cf3c5]
at
2008-12-07 03:06:33
on branch trunk
— Remove writeWideCString as that's a bad idea.
Endianess, size etc. may differ from system to system. While this might
be ok when writing files that are only read local again, this is
definitely not ok with sockets. So it's better to remove it from the
OFStream protocol. (user: js, size: 1464) [annotate] [blame] [check-ins using]
/* * Copyright (c) 2008 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ /** * The OFStream protocol provides functions to read and write streams. */ @protocol OFStream /** * Reads from the stream into a buffer. * * \param buf The buffer into which the data is read * \param size The size of the data that should be read. * The buffer MUST be at least size big! * \return The number of bytes read */ - (size_t)readNBytes: (size_t)size intoBuffer: (uint8_t*)buf; /** * Reads from the stream into a new buffer. * * \param size The size of the data that should be read * \return A new buffer with the data read. * It is part of the memory pool of the OFFile. */ - (uint8_t*)readNBytes: (size_t)size; /** * Writes from a buffer into the stream. * * \param buf The buffer from which the data is written to the stream * \param size The size of the data that should be written * \return The number of bytes written */ - (size_t)writeNBytes: (size_t)size fromBuffer: (const uint8_t*)buf; /** * Writes a C string into the stream, without the trailing zero. * * \param str The C string from which the data is written to the stream * \return The number of bytes written */ - (size_t)writeCString: (const char*)str; @end