2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.util
;
18 import java
.io
.IOException
;
19 import java
.io
.InputStream
;
21 public class ScrambledInputStream
extends InputStream
{
22 private static final int MASK
= ScrambledOutputStream
.MASK
;
23 private final InputStream myOriginalStream
;
25 public ScrambledInputStream(InputStream originalStream
) {
26 myOriginalStream
= originalStream
;
29 public int read() throws IOException
{
30 int b
= myOriginalStream
.read();
31 if (b
== -1) return -1;
35 public int read(byte[] b
, int off
, int len
) throws IOException
{
36 int read
= myOriginalStream
.read(b
, off
, len
);
37 for(int i
= 0; i
< read
; i
++){
43 public long skip(long n
) throws IOException
{
44 return myOriginalStream
.skip(n
);
47 public int available() throws IOException
{
48 return myOriginalStream
.available();
51 public void close() throws IOException
{
52 myOriginalStream
.close();
55 public synchronized void mark(int readlimit
) {
56 myOriginalStream
.mark(readlimit
);
59 public synchronized void reset() throws IOException
{
60 myOriginalStream
.reset();
63 public boolean markSupported() {
64 return myOriginalStream
.markSupported();