MacInputStream (GNU cryptographic primitives and tools)
Keywords: gnu.crypto.mac.MacInputStream,MacInputStream class

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| For the latest news and information visit The GNU Crypto project
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gnu.crypto.mac
Class MacInputStream

    java.lang.Object
      |
      +--java.io.InputStream
            |
            +--java.io.FilterInputStream
                  |
                  +--gnu.crypto.mac.MacInputStream

public class MacInputStream
extends java.io.FilterInputStream

A filtering input stream that computes a MAC (message authentication code) over all data read from the stream.

Field Summary

Fields inherited from class java.io.FilterInputStream
`in`

Constructor Summary
`MacInputStream(java.io.InputStream in, IMac mac)` Creates a new MacInputStream.

Method Summary
`IMac` | `getMac()` Returns the MAC this stream is updating.
`void` | `on(boolean flag)` Turns the digesting state on or off.
`int` | `read()`
`int` | `read(byte[] buf, int off, int len)`
`void` | `setMac(IMac mac)` Sets the MAC this stream is updating, which must have already been initialized.

Methods inherited from class java.io.FilterInputStream
`available, close, mark, markSupported, read, reset, skip`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MacInputStream

    public MacInputStream(java.io.InputStream in,
                          IMac mac)

  Creates a new MacInputStream. The stream is initially set to digest data written, the mac argument must have already been initialized, and the mac argument is not cloned.

Parameters:
  `in` - The underlying input stream.
  `mac` - The mac instance to use.

Method Detail

### getMac

    public IMac getMac()

  Returns the MAC this stream is updating.

  Returns:
    The MAC.

### setMac

    public void setMac(IMac mac)

  Sets the MAC this stream is updating, which must have already been initialized. The argument is not cloned by this method.

  Parameters:
    `mac` - The new MAC.
  Throws:
    `java.lang.NullPointerException` - If the argument is null.

### on

    public void on(boolean flag)

  Turns the digesting state on or off. When off, the MAC will not be updated when data is written to the stream.

  Parameters:
    `flag` - The new digesting state.

### read

    public int read()
             throws java.io.IOException

  Overrides:
    `read` in class `java.io.FilterInputStream`
    `java.io.IOException`

### read

    public int read(byte[] buf,
                    int off,
                    int len)
             throws java.io.IOException

  Overrides:
    `read` in class `java.io.FilterInputStream`
    `java.io.IOException`

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| For the latest news and information visit The GNU Crypto project
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001, 2002, 2003, 2004 Free Software Foundation, Inc.