nsIInputStream.idl revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
0N/A/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2362N/A/* ***** BEGIN LICENSE BLOCK ***** 0N/A * Version: MPL 1.1/GPL 2.0/LGPL 2.1 0N/A * The contents of this file are subject to the Mozilla Public License Version 0N/A * 1.1 (the "License"); you may not use this file except in compliance with 2362N/A * the License. You may obtain a copy of the License at 0N/A * Software distributed under the License is distributed on an "AS IS" basis, 0N/A * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 0N/A * for the specific language governing rights and limitations under the 0N/A * The Original Code is mozilla.org code. 0N/A * The Initial Developer of the Original Code is 0N/A * Netscape Communications Corporation. 0N/A * Portions created by the Initial Developer are Copyright (C) 1998 0N/A * the Initial Developer. All Rights Reserved. 2362N/A * Warren Harris <warren@netscape.com> 0N/A * Darin Fisher <darin@netscape.com> 0N/A * Alternatively, the contents of this file may be used under the terms of 0N/A * either of the GNU General Public License Version 2 or later (the "GPL"), 0N/A * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), 0N/A * in which case the provisions of the GPL or the LGPL are applicable instead 0N/A * of those above. If you wish to allow use of your version of this file only 0N/A * under the terms of either the GPL or the LGPL, and not to allow others to 0N/A * use your version of this file under the terms of the MPL, indicate your 0N/A * decision by deleting the provisions above and replace them with the notice 0N/A * and other provisions required by the GPL or the LGPL. If you do not delete 0N/A * the provisions above, a recipient may use your version of this file under 0N/A * the terms of any one of the MPL, the GPL or the LGPL. 0N/A * ***** END LICENSE BLOCK ***** */ 0N/A * The signature of the writer function passed to ReadSegments. This 0N/A * is the "consumer" of data that gets read from the stream's buffer. 0N/A * @param aInStream stream being read 0N/A * @param aClosure opaque parameter passed to ReadSegments 0N/A * @param aFromSegment pointer to memory owned by the input stream 0N/A * @param aToOffset amount already read (since ReadSegments was called) * @param aCount length of fromSegment * @param aWriteCount number of bytes read * Implementers should return the following: * @return NS_OK and (*aWriteCount > 0) if consumed some data * @return <any-error> if not interested in consuming any data * Errors are never passed to the caller of ReadSegments. * NOTE: returning NS_OK and (*aWriteCount = 0) has undefined behavior. * @return number of bytes currently available in the stream * Read data from the stream. * @param aBuf the buffer into which the data is to be read * @param aCount the maximum number of bytes to be read * @return number of bytes read (may be less than aCount). * @return 0 if reached end of file * @throws NS_BASE_STREAM_WOULD_BLOCK if reading from the input stream would * block the calling thread (non-blocking mode only) * @throws <other-error> on failure * Low-level read method that has access to the stream's underlying buffer. * The writer function may be called multiple times for segmented buffers. * ReadSegments is expected to keep calling the writer until either there is * nothing left to read or the writer returns an error. ReadSegments should * not call the writer with zero bytes to consume. * @param aWriter the "consumer" of the data to be read * @param aClosure opaque parameter passed to writer * @param aCount the maximum number of bytes to be read * @return number of bytes read (may be less than aCount) * @return 0 if reached end of file (or if aWriter refused to consume data) * @throws NS_BASE_STREAM_WOULD_BLOCK if reading from the input stream would * block the calling thread (non-blocking mode only) * @throws <other-error> on failure * NOTE: this function may be unimplemented if a stream has no underlying * buffer (e.g., socket input stream). * @return true if stream is non-blocking