• BlackBerry Dynamics
  • Runtime library for Android applications
  • 12.0.1.79
FileInputStream Class Reference

Extension of java.io.InputStream for reading data from the secure file system. More...

Inheritance diagram for FileInputStream:
InputStream

Description

This class is a subclass of java.io.InputStream for reading data from the BlackBerry Dynamics secure file system.

See the com.good.gd.file package documentation for an introduction to the secure file system.

This class has the same programming interface as the java.io.FileInputStream class, which inherits from java.io.InputStream, with the following exceptions.

  • FileChannel isn't supported. There is no getChannel method.
  • FileDescriptor isn't supported. There is no getFD method. There is no constructor to create a stream from a descriptor.

See also
The java.io.FileInputStream and java.io.InputStream reference documentation on the android.com developer website for details of all methods.

Notice

The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.

/*
 * Copyright (C) 2006 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

Public Member Functions

 FileInputStream (String name) throws FileNotFoundException
 Constructor that opens a file for reading, from a String containing the path in the secure store. More...
 
 FileInputStream (File file) throws FileNotFoundException
 Constructor that opens a file for reading, from a File containing the path in the secure store. More...
 
int available () throws IOException
 Check how many bytes are available on an open file in the secure store. More...
 
int read () throws IOException
 Read one byte from a file in the secure store. More...
 
int read (byte[] b) throws IOException
 Fill a byte buffer with data read from a file in the secure store. More...
 
int read (byte[] b, int off, int len) throws IOException
 Read a specified amount of data from a file in the secure store into a byte buffer, at a specified offset. More...
 
long skip (long n) throws IOException
 Read and discard a number of bytes from an open file in the secure store. More...
 
void close () throws IOException
 Close a file in the secure store. More...
 
void mark (int readlimit)
 Mark the current position of an open file in the secure store, for later reset. More...
 
void reset () throws IOException
 Reset an open file in the secure store to the position of an earlier mark. More...
 
boolean markSupported ()
 Test whether an open file in the secure store supports mark and reset; always true. More...
 

Constructor & Destructor Documentation

◆ FileInputStream() [1/2]

FileInputStream ( String  name) throws FileNotFoundException

Call this constructor to open a file in the secure store, for reading.

Parameters
nameString containing the path of the file to open, in the secure file system.
Exceptions
FileNotFoundException
com.good.gd.error.GDNotAuthorizedErrorif BlackBerry Dynamics authorization processing has not yet completed.

◆ FileInputStream() [2/2]

FileInputStream ( File  file) throws FileNotFoundException

Call this constructor to open a file in the secure store, for reading.

Parameters
fileFile containing the path of the file to open, in the secure file system.
Exceptions
FileNotFoundException
com.good.gd.error.GDNotAuthorizedErrorif BlackBerry Dynamics authorization processing has not yet completed.

Member Function Documentation

◆ available()

int available ( ) throws IOException
Returns
int representation of the number of bytes currently available to read.
Exceptions
IOException

◆ read() [1/3]

int read ( ) throws IOException

Call this method to read one byte from an open file in the secure store.

Returns
int representation of the next byte of data, or -1 if the end of the file has been reached.
Exceptions
IOException

◆ read() [2/3]

int read ( byte[]  b) throws IOException

Call this method to read data from a file in the secure store into a byte buffer. No more data will be read than can be stored in the buffer.

Parameters
bbyte array into which data will be read.
Returns
int representation of the number of bytes actually read, or -1 if the end of the file has been reached.
Exceptions
IOException

◆ read() [3/3]

int read ( byte[]  b,
int  off,
int  len 
) throws IOException

Call this method to read data from a file in the secure store into a byte buffer. The data that is read will be written into the buffer starting at a specified offset. No more data will be read than a specified maximum.

Parameters
bbyte array for the buffer into which data will be written.
offint offset into the buffer, at which writing is to begin.
lenint maximum number of bytes to read.
Returns
int representation of the number of bytes actually read, or -1 if the end of the file has been reached.
Exceptions
IOException

◆ skip()

long skip ( long  n) throws IOException
Parameters
nlong specifying how many bytes to skip.
Returns
long representation of the number of bytes actually skipped.
Exceptions
IOException

◆ close()

void close ( ) throws IOException

Call this method to close an open file in the secure store. Any resources associated with the open file's stream will be released.

Exceptions
IOException

◆ mark()

void mark ( int  readlimit)

Call this method to mark the current position of an open file in the secure store. This enables a later call to reset. The reset call must take place before a specified amount of data has been read from the stream.

Parameters
readlimitint specifying the amount of data that can be read in between the call to this method and the subsequent call to reset.
Exceptions
IOException

◆ reset()

void reset ( ) throws IOException

Call this method to reset an open file in the secure store to the position of an earlier call to mark.

This method will throw an IOException if there was no earlier call to mark, or if the specified readlimit has been passed.

Exceptions
IOException

◆ markSupported()

boolean markSupported ( )

Call this method to check whether an open file in the secure store supports the mark and reset methods. Open files in the secure store always support mark and reset.

Returns
true always.
Exceptions
IOException