mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Added
This commit is contained in:
parent
247cfa3b19
commit
fb7ad57ff3
95
modules/libjar/nsIZipReader.idl
Normal file
95
modules/libjar/nsIZipReader.idl
Normal file
@ -0,0 +1,95 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Don Bragg <dbragg@netscape.com>
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
* Mitch Stoltz <mstoltz@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISimpleEnumerator;
|
||||
interface nsIInputStream;
|
||||
native nsFileSpec(nsFileSpec&);
|
||||
|
||||
[scriptable, uuid(6ca5e43e-9632-11d3-8cd9-0060b0fc14a3)]
|
||||
interface nsIZipEntry : nsISupports
|
||||
{
|
||||
readonly attribute string name;
|
||||
readonly attribute unsigned short compression;
|
||||
readonly attribute unsigned long size;
|
||||
readonly attribute unsigned long realSize;
|
||||
readonly attribute unsigned long CRC32;
|
||||
};
|
||||
|
||||
[scriptable, uuid(6ff6a966-9632-11d3-8cd9-0060b0fc14a3)]
|
||||
interface nsIZipReader : nsISupports
|
||||
{
|
||||
/**
|
||||
* Initializes a zip reader after construction.
|
||||
*/
|
||||
[noscript] void init(in nsFileSpec zipFile);
|
||||
|
||||
/**
|
||||
* Opens a zip reader.
|
||||
*/
|
||||
void open();
|
||||
|
||||
/**
|
||||
* Closes a zip reader. Subsequent attempts to extract files or read from
|
||||
* its input stream will result in an error.
|
||||
*/
|
||||
void close();
|
||||
|
||||
/**
|
||||
* Extracts a zip entry into a local file specified by outFile.
|
||||
*/
|
||||
[noscript] void extract(in string zipEntry, in nsFileSpec outFile);
|
||||
|
||||
/**
|
||||
* Returns a nsIZipEntry describing a specified zip entry.
|
||||
*/
|
||||
nsIZipEntry getEntry(in string zipEntry);
|
||||
|
||||
/**
|
||||
* Returns a simple enumerator whose elements are of type nsIZipEntry.
|
||||
*/
|
||||
nsISimpleEnumerator/*<nsIZipEntry>*/ findEntries(in string aPattern);
|
||||
|
||||
/**
|
||||
* Returns an input stream containing the contents of the specified zip entry.
|
||||
*/
|
||||
nsIInputStream getInputStream(in string zipEntry);
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
#define NS_ZIPREADER_CID \
|
||||
{ /* 7526a738-9632-11d3-8cd9-0060b0fc14a3 */ \
|
||||
0x7526a738, \
|
||||
0x9632, \
|
||||
0x11d3, \
|
||||
{0x8c, 0xd9, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
|
||||
}
|
||||
|
||||
%}
|
||||
|
102
netwerk/base/src/nsAsyncStreamListener.h
Normal file
102
netwerk/base/src/nsAsyncStreamListener.h
Normal file
@ -0,0 +1,102 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsAsyncStreamListener_h__
|
||||
#define nsAsyncStreamListener_h__
|
||||
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIEventQueue.h"
|
||||
#include "nsIStreamObserver.h"
|
||||
#include "nsIStreamListener.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsAsyncStreamObserver : public nsIAsyncStreamObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISTREAMOBSERVER
|
||||
NS_DECL_NSIASYNCSTREAMOBSERVER
|
||||
|
||||
// nsAsyncStreamObserver methods:
|
||||
nsAsyncStreamObserver()
|
||||
: mStatus(NS_OK)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
virtual ~nsAsyncStreamObserver();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsISupports* GetReceiver() { return mReceiver.get(); }
|
||||
nsresult GetStatus() { return mStatus; }
|
||||
void SetStatus(nsresult value) { mStatus = value; }
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIEventQueue> mEventQueue;
|
||||
nsCOMPtr<nsIStreamObserver> mReceiver;
|
||||
nsresult mStatus;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsAsyncStreamListener : public nsAsyncStreamObserver,
|
||||
public nsIAsyncStreamListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIStreamListener methods:
|
||||
NS_IMETHOD OnStartRequest(nsIChannel* channel,
|
||||
nsISupports* context)
|
||||
{
|
||||
return nsAsyncStreamObserver::OnStartRequest(channel, context);
|
||||
}
|
||||
|
||||
NS_IMETHOD OnStopRequest(nsIChannel* channel,
|
||||
nsISupports* context,
|
||||
nsresult aStatus,
|
||||
const PRUnichar* aMsg)
|
||||
{
|
||||
return nsAsyncStreamObserver::OnStopRequest(channel, context, aStatus, aMsg);
|
||||
}
|
||||
|
||||
NS_IMETHOD OnDataAvailable(nsIChannel* channel, nsISupports* context,
|
||||
nsIInputStream *aIStream,
|
||||
PRUint32 aSourceOffset,
|
||||
PRUint32 aLength);
|
||||
|
||||
// nsIAsyncStreamListener methods:
|
||||
NS_IMETHOD Init(nsIStreamListener* aListener, nsIEventQueue* aEventQ) {
|
||||
return nsAsyncStreamObserver::Init(aListener, aEventQ);
|
||||
}
|
||||
|
||||
// nsAsyncStreamListener methods:
|
||||
nsAsyncStreamListener() {}
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // nsAsyncStreamListener_h__
|
53
netwerk/base/src/nsSyncStreamListener.h
Normal file
53
netwerk/base/src/nsSyncStreamListener.h
Normal file
@ -0,0 +1,53 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef nsSyncStreamListener_h__
|
||||
#define nsSyncStreamListener_h__
|
||||
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIBufferInputStream.h"
|
||||
#include "nsIBufferOutputStream.h"
|
||||
|
||||
class nsSyncStreamListener : public nsISyncStreamListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISTREAMOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
NS_DECL_NSISYNCSTREAMLISTENER
|
||||
|
||||
// nsSyncStreamListener methods:
|
||||
nsSyncStreamListener()
|
||||
: mOutputStream(nsnull) {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
virtual ~nsSyncStreamListener();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsIBufferOutputStream* GetOutputStream() { return mOutputStream; }
|
||||
|
||||
protected:
|
||||
nsIBufferOutputStream* mOutputStream;
|
||||
};
|
||||
|
||||
#define NS_SYNC_STREAM_LISTENER_SEGMENT_SIZE (4 * 1024)
|
||||
#define NS_SYNC_STREAM_LISTENER_BUFFER_SIZE (32 * 1024)
|
||||
|
||||
#endif // nsSyncStreamListener_h__
|
Loading…
Reference in New Issue
Block a user