javax.crypto
Class CipherInputStream
- AutoCloseable, Closeable
This is an
InputStream
that filters its data
through a
Cipher
before returning it. The
Cipher
argument must have been initialized before it is passed to the
constructor.
int | available() - Returns the number of bytes available without blocking.
|
void | close() - Close this input stream.
|
void | mark(int mark) - Set the mark.
|
boolean | markSupported() - Returns whether or not this input stream supports the
mark(long) and reset() methods; this input stream does
not, however, and invariably returns false .
|
int | read() - Read a single byte from this input stream; returns -1 on the
end-of-file.
|
int | read(byte[] buf) - Read bytes into an array, returning the number of bytes read or -1
on the end-of-file.
|
int | read(byte[] buf, int off, int len) - Read bytes into an array, returning the number of bytes read or -1
on the end-of-file.
|
void | reset() - Reset to the mark.
|
long | skip(long bytes) - Skip a number of bytes.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
CipherInputStream
protected CipherInputStream(InputStream in)
Creates a new input stream without a cipher. This constructor is
protected
because this class does not work without an
underlying cipher.
in
- The underlying input stream.
CipherInputStream
public CipherInputStream(InputStream in,
Cipher cipher)
Creates a new input stream with a source input stream and cipher.
in
- The underlying input stream.cipher
- The cipher to filter data through.
available
public int available()
throws IOException
Returns the number of bytes available without blocking. The value
returned is the number of bytes that have been processed by the
cipher, and which are currently buffered by this class.
- available in interface FilterInputStream
- The number of bytes immediately available.
read
public int read()
throws IOException
Read a single byte from this input stream; returns -1 on the
end-of-file.
- read in interface FilterInputStream
- The byte read, or -1 if there are no more bytes.
read
public int read(byte[] buf)
throws IOException
Read bytes into an array, returning the number of bytes read or -1
on the end-of-file.
- read in interface FilterInputStream
buf
- The byte arry to read into.
- The number of bytes read, or -1 on the end-of-file.
read
public int read(byte[] buf,
int off,
int len)
throws IOException
Read bytes into an array, returning the number of bytes read or -1
on the end-of-file.
- read in interface FilterInputStream
buf
- The byte array to read into.off
- The offset in buf
to start.len
- The maximum number of bytes to read.
- The number of bytes read, or -1 on the end-of-file.
skip
public long skip(long bytes)
throws IOException
Skip a number of bytes. This class only supports skipping as many
bytes as are returned by
available()
, which is the number
of transformed bytes currently in this class's internal buffer.
- skip in interface FilterInputStream
bytes
- The number of bytes to skip.
- The number of bytes skipped.
CipherInputStream.java -- Filters input through a cipher.
Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.