1/*
2 * Copyright 2008, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Michael Pfeiffer 	<laplace@users.sourceforge.net>
7 *		Fredrik Mod��en		<fredrik@modeen.se>
8 */
9#ifndef FILE_READ_WRITE_H
10#define FILE_READ_WRITE_H
11
12#include <stdio.h>
13#include <File.h>
14#include <String.h>
15
16
17class FileReadWrite {
18public:
19								FileReadWrite(BFile* file,
20									int32 sourceEncoding = -1);
21									// -1 means "default" encoding
22			bool				Next(BString& string);
23			status_t			Write(const BString& contents) const;
24			void				SetEncoding(int32 sourceEncoding);
25			uint32				GetEncoding() const;
26
27private:
28			BFile*				fFile;
29			int32				fSourceEncoding;
30			char				fBuffer[4096];
31			off_t				fPositionInBuffer;
32			ssize_t				fAmtRead;
33};
34
35#endif //FILE_READ_WRITE_H
36