OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.net; | 5 package org.chromium.net.impl; |
6 | 6 |
7 import java.io.FileInputStream; | 7 import java.io.FileInputStream; |
8 import java.io.IOException; | 8 import java.io.IOException; |
9 import java.io.InputStream; | 9 import java.io.InputStream; |
10 import java.nio.ByteBuffer; | 10 import java.nio.ByteBuffer; |
11 import java.nio.channels.ReadableByteChannel; | 11 import java.nio.channels.ReadableByteChannel; |
12 import java.util.concurrent.atomic.AtomicBoolean; | 12 import java.util.concurrent.atomic.AtomicBoolean; |
13 | 13 |
14 /** | 14 /** |
15 * Adapts an {@link InputStream} into a {@link ReadableByteChannel}, exactly lik
e | 15 * Adapts an {@link InputStream} into a {@link ReadableByteChannel}, exactly lik
e |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 return mIsOpen.get(); | 66 return mIsOpen.get(); |
67 } | 67 } |
68 | 68 |
69 @Override | 69 @Override |
70 public void close() throws IOException { | 70 public void close() throws IOException { |
71 if (mIsOpen.compareAndSet(true, false)) { | 71 if (mIsOpen.compareAndSet(true, false)) { |
72 mInputStream.close(); | 72 mInputStream.close(); |
73 } | 73 } |
74 } | 74 } |
75 } | 75 } |
OLD | NEW |