\input strlist.tex
\input strmbase.tex
\input stream.tex
+\input strmmem.tex
\input sysclevt.tex
\input settings.tex
\input tab.tex
An initialized write-only stream.
+\wxheading{See also}
+
+\helpref{wxOutputStream}{wxoutputstream}
Creates a new input stream on the the specified path. You can use all but seek
functionnality of wxStream. Seek isn't available on all stream. For example,
-http or ftp streams doesn't deal with it.
+http or ftp streams doesn't deal with it. Other functions like StreamSize and
+Tell aren't available for the moment for this sort of stream.
+You will be notified when the EOF is reached by an error.
\wxheading{Return value}
-Returns the initialized stream. You will have to delete it yourself.
+Returns the initialized stream. You will have to delete it yourself once you
+don't use it anymore. The destructor closes the network connection.
+
+\wxheading{See also}
+
+\helpref{wxInputStream}{wxinputstream}
% ----------------------------------------------------------------------------
\membersection{wxProtocol::Abort}\label{wxprotoabort}
Abort the current stream.
-\it{WARNING: It is advised to destroy the input stream instead of aborting the stream this way.}
+\wxheading{Warning}
+
+It is advised to destroy the input stream instead of aborting the stream this way.
\wxheading{Return value}
\func{void}{SetPassword}{\param{const wxString\&}{ user}}
Sets the authentication password. It is mainly useful when FTP is used.
-
\wxheading{Warning}
The "read\_write" mode may not work: it isn't completely finished.
+You can create "memory" streams by this way:
+\begin{verbatim}
+ wxStreamBuffer *sb = new wxStreamBuffer(wxStreamBuffer::read)
+ wxInputStream *input = new wxInputStream(sb);
+
+ sb->Fixed(FALSE); // It can change the size of the buffer.
+
+ // input is now a read-only memory stream.
+\end{verbatim}
+But you should care about destroying the stream buffer \it{YOURSELF}.
\wxheading{See also}
\constfunc{off_t}{OnSysTell}{\void}
Internal function. Is is called when the stream buffer needs to know the
-current position in the stream.
+real position in the stream.
virtual ~wxMemoryOutputStream();
};
-class wxMemoryStream: public wxMemoryInputStream, public wxMemoryOutputStream {
- public:
- wxMemoryStream(char *data = NULL, size_t length = 0);
- virtual ~wxMemoryStream();
-};
-
#endif
wxInputStream *wxFTP::GetInputStream(const wxString& path)
{
wxString tmp_str;
+ size_t calc_size;
if (!SendCommand("TYPE I", '2'))
return NULL;
wxSocketBase& wxSocketBase::Read(char* buffer, size_t nbytes)
{
m_lcount = GetPushback(buffer, nbytes, FALSE);
+ nbytes -= m_lcount;
// If we have got the whole needed buffer or if we don't want to
// wait then it returns immediately.
{
wxASSERT(m_stream != NULL);
+ if (m_mode == write)
+ return 0;
+
// ------------------
// Buffering disabled
// ------------------
char buf[BUF_TEMP_SIZE];
size_t s = 0, bytes_read = BUF_TEMP_SIZE;
+ if (m_mode == write)
+ return 0;
+
while (bytes_read == BUF_TEMP_SIZE) {
bytes_read = Read(buf, bytes_read);
bytes_read = s_buf->Write(buf, bytes_read);
{
wxASSERT(m_stream != NULL);
+ if (m_mode == read)
+ return 0;
+
// ------------------
// Buffering disabled
// ------------------
char buf[BUF_TEMP_SIZE];
size_t s = 0, bytes_count = BUF_TEMP_SIZE, b_count2;
+ if (m_mode == read)
+ return 0;
+
while (bytes_count == BUF_TEMP_SIZE) {
b_count2 = sbuf->Read(buf, bytes_count);
bytes_count = Write(buf, b_count2);
#endif
#include <wx/stream.h>
#include <wx/wfstream.h>
-#include <wx/mstream.h>
#include "mmfile.h"
m_tmpfname((char *)NULL), m_mfname((char *)NULL),
m_seekable(seekable)
{
-/*
if (preload) {
- wxMemoryStream *tmpstream = new wxMemoryStream();
+ wxStreamBuffer *streamb = new wxStreamBuffer(wxStreamBuffer::read_write);
- m_o_temp = tmpstream;
- m_i_temp = tmpstream;
+ streamb->Fixed(FALSE);
+ streamb->Flushable(FALSE);
+
+ m_o_temp = new wxOutputStream(streamb);
+ m_i_temp = new wxInputStream(streamb);
m_o_temp->Write(is);
+ streamb->ResetBuffer();
}
-*/
}
wxMMediaFile::wxMMediaFile(const wxString& fname)
m_ostream = NULL;
m_seekable = seekable;
-/*
if (preload) {
- wxMemoryStream *tmpstream = new wxMemoryStream();
+ wxStreamBuffer *streamb = new wxStreamBuffer(wxStreamBuffer::read_write);
+
+ streamb->Fixed(FALSE);
+ streamb->Flushable(FALSE);
- m_i_temp = tmpstream;
- m_o_temp = tmpstream;
+ m_o_temp = new wxOutputStream(streamb);
+ m_i_temp = new wxInputStream(streamb);
- m_o_temp->Write(str);
+ m_o_temp->Write(is);
+ streamb->ResetBuffer();
}
-*/
}
void wxMMediaFile::SetFile(wxOutputStream& str, bool seekable)
if (m_ostream)
m_ostream->Write(*m_i_temp);
- delete m_i_temp; // Only one delete because m_tmpo* and m_tmpi* are linked
+ delete m_i_temp->StreamBuffer();
+ delete m_i_temp;
+ delete m_o_temp;
if (m_tmpfname)
wxRemoveFile(m_tmpfname);
+////////////////////////////////////////////////////////////////////////////////
+// Name: sndpcm.cpp
+// Purpose: wxMMedia
+// Author: Guilhem Lavaux
+// Created: 1998
+// Updated: 1999
+// Copyright: (C) 1997, 1998, 1999, Guilhem Lavaux
+// License: wxWindows license
+////////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "sndpcm.h"
#endif
} else {
while (StreamOk()) {
temp = GET();
+ temp2 = GET();
PUT(temp ^ signer1);
if (!StreamOk()) {
m_in_sound->WriteBack(temp);
+ m_in_sound->WriteBack(temp2);
break;
}
PUT(GET() ^ signer2);
PUT(temp ^ signer1);
if (!StreamOk()) {
m_in_sound->WriteBack(temp);
+ m_in_sound->WriteBack(temp2);
break;
}
PUT(temp2 ^ signer2);
#include "mmfile.h"
#include "wx/string.h"
#include "wx/window.h"
+#include "wx/frame.h"
///
typedef enum {