Showing preview only (7,127K chars total). Download the full file or copy to clipboard to get everything.
Repository: JeffMony/MediaSDK
Branch: master
Commit: b9fc6524c5ec
Files: 946
Total size: 6.6 MB
Directory structure:
gitextract_ez39w3qr/
├── .gitignore
├── LICENSE
├── README.md
├── README_cn.md
├── androidasync/
│ ├── .gitignore
│ ├── androidasync.iml
│ ├── build.gradle
│ ├── consumer-rules.pro
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ └── java/
│ └── com/
│ └── jeffmony/
│ └── async/
│ ├── AsyncDatagramSocket.java
│ ├── AsyncNetworkSocket.java
│ ├── AsyncSSLException.java
│ ├── AsyncSSLServerSocket.java
│ ├── AsyncSSLSocket.java
│ ├── AsyncSSLSocketWrapper.java
│ ├── AsyncSemaphore.java
│ ├── AsyncServer.java
│ ├── AsyncServerSocket.java
│ ├── AsyncSocket.java
│ ├── BufferedDataSink.java
│ ├── ByteBufferList.java
│ ├── ChannelWrapper.java
│ ├── DataEmitter.java
│ ├── DataEmitterBase.java
│ ├── DataEmitterReader.java
│ ├── DataSink.java
│ ├── DataTrackingEmitter.java
│ ├── DatagramChannelWrapper.java
│ ├── FileDataEmitter.java
│ ├── FilteredDataEmitter.java
│ ├── FilteredDataSink.java
│ ├── HostnameResolutionException.java
│ ├── LineEmitter.java
│ ├── PushParser.java
│ ├── SelectorWrapper.java
│ ├── ServerSocketChannelWrapper.java
│ ├── SocketChannelWrapper.java
│ ├── TapCallback.java
│ ├── ThreadQueue.java
│ ├── Util.java
│ ├── ZipDataSink.java
│ ├── callback/
│ │ ├── CompletedCallback.java
│ │ ├── ConnectCallback.java
│ │ ├── ContinuationCallback.java
│ │ ├── DataCallback.java
│ │ ├── ListenCallback.java
│ │ ├── ResultCallback.java
│ │ ├── SocketCreateCallback.java
│ │ ├── ValueCallback.java
│ │ ├── ValueFunction.java
│ │ └── WritableCallback.java
│ ├── dns/
│ │ ├── Dns.java
│ │ └── DnsResponse.java
│ ├── future/
│ │ ├── Cancellable.java
│ │ ├── Continuation.java
│ │ ├── Converter.java
│ │ ├── DependentCancellable.java
│ │ ├── DependentFuture.java
│ │ ├── DoneCallback.java
│ │ ├── FailCallback.java
│ │ ├── FailConvertCallback.java
│ │ ├── FailRecoverCallback.java
│ │ ├── Future.java
│ │ ├── FutureCallback.java
│ │ ├── FutureRunnable.java
│ │ ├── FutureThread.java
│ │ ├── Futures.java
│ │ ├── HandlerFuture.java
│ │ ├── MultiFuture.java
│ │ ├── MultiTransformFuture.java
│ │ ├── SimpleCancellable.java
│ │ ├── SimpleFuture.java
│ │ ├── SuccessCallback.java
│ │ ├── ThenCallback.java
│ │ ├── ThenFutureCallback.java
│ │ ├── TransformFuture.java
│ │ └── TypeConverter.java
│ ├── http/
│ │ ├── AsyncHttpClient.java
│ │ ├── AsyncHttpClientMiddleware.java
│ │ ├── AsyncHttpDelete.java
│ │ ├── AsyncHttpGet.java
│ │ ├── AsyncHttpHead.java
│ │ ├── AsyncHttpPost.java
│ │ ├── AsyncHttpPut.java
│ │ ├── AsyncHttpRequest.java
│ │ ├── AsyncHttpResponse.java
│ │ ├── AsyncHttpResponseImpl.java
│ │ ├── AsyncSSLEngineConfigurator.java
│ │ ├── AsyncSSLSocketMiddleware.java
│ │ ├── AsyncSocketMiddleware.java
│ │ ├── BasicNameValuePair.java
│ │ ├── BodyDecoderException.java
│ │ ├── ConnectionClosedException.java
│ │ ├── ConnectionFailedException.java
│ │ ├── Headers.java
│ │ ├── HttpDate.java
│ │ ├── HttpTransportMiddleware.java
│ │ ├── HttpUtil.java
│ │ ├── HybiParser.java
│ │ ├── Multimap.java
│ │ ├── NameValuePair.java
│ │ ├── Protocol.java
│ │ ├── ProtocolVersion.java
│ │ ├── RedirectLimitExceededException.java
│ │ ├── RequestLine.java
│ │ ├── SSLEngineSNIConfigurator.java
│ │ ├── SimpleMiddleware.java
│ │ ├── TaggedList.java
│ │ ├── WebSocket.java
│ │ ├── WebSocketHandshakeException.java
│ │ ├── WebSocketImpl.java
│ │ ├── body/
│ │ │ ├── AsyncHttpRequestBody.java
│ │ │ ├── ByteBufferListRequestBody.java
│ │ │ ├── DocumentBody.java
│ │ │ ├── FileBody.java
│ │ │ ├── FilePart.java
│ │ │ ├── JSONArrayBody.java
│ │ │ ├── JSONObjectBody.java
│ │ │ ├── MultipartFormDataBody.java
│ │ │ ├── Part.java
│ │ │ ├── StreamBody.java
│ │ │ ├── StreamPart.java
│ │ │ ├── StringBody.java
│ │ │ ├── StringPart.java
│ │ │ └── UrlEncodedFormBody.java
│ │ ├── cache/
│ │ │ ├── HeaderParser.java
│ │ │ ├── Objects.java
│ │ │ ├── RawHeaders.java
│ │ │ ├── RequestHeaders.java
│ │ │ ├── ResponseCacheMiddleware.java
│ │ │ ├── ResponseHeaders.java
│ │ │ ├── ResponseSource.java
│ │ │ └── StrictLineReader.java
│ │ ├── callback/
│ │ │ ├── HttpConnectCallback.java
│ │ │ └── RequestCallback.java
│ │ ├── filter/
│ │ │ ├── ChunkedDataException.java
│ │ │ ├── ChunkedInputFilter.java
│ │ │ ├── ChunkedOutputFilter.java
│ │ │ ├── ContentLengthFilter.java
│ │ │ ├── DataRemainingException.java
│ │ │ ├── GZIPInputFilter.java
│ │ │ ├── InflaterInputFilter.java
│ │ │ └── PrematureDataEndException.java
│ │ └── server/
│ │ ├── AsyncHttpRequestBodyProvider.java
│ │ ├── AsyncHttpServer.java
│ │ ├── AsyncHttpServerRequest.java
│ │ ├── AsyncHttpServerRequestImpl.java
│ │ ├── AsyncHttpServerResponse.java
│ │ ├── AsyncHttpServerResponseImpl.java
│ │ ├── AsyncHttpServerRouter.java
│ │ ├── AsyncProxyServer.java
│ │ ├── BoundaryEmitter.java
│ │ ├── HttpServerRequestCallback.java
│ │ ├── MalformedRangeException.java
│ │ ├── MimeEncodingException.java
│ │ ├── RouteMatcher.java
│ │ ├── StreamSkipException.java
│ │ └── UnknownRequestBody.java
│ ├── parser/
│ │ ├── AsyncParser.java
│ │ ├── ByteBufferListParser.java
│ │ ├── DocumentParser.java
│ │ ├── JSONArrayParser.java
│ │ ├── JSONObjectParser.java
│ │ └── StringParser.java
│ ├── stream/
│ │ ├── ByteBufferListInputStream.java
│ │ ├── FileDataSink.java
│ │ ├── InputStreamDataEmitter.java
│ │ ├── OutputStreamDataCallback.java
│ │ └── OutputStreamDataSink.java
│ ├── util/
│ │ ├── Allocator.java
│ │ ├── ArrayDeque.java
│ │ ├── Charsets.java
│ │ ├── Deque.java
│ │ ├── FileCache.java
│ │ ├── FileUtility.java
│ │ ├── HashList.java
│ │ ├── IdleTimeout.java
│ │ ├── LruCache.java
│ │ ├── StreamUtility.java
│ │ ├── TaggedList.java
│ │ ├── ThrottleTimeout.java
│ │ ├── TimeoutBase.java
│ │ └── UntypedHashtable.java
│ └── wrapper/
│ ├── AsyncSocketWrapper.java
│ └── DataEmitterWrapper.java
├── app/
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── assets/
│ │ └── list.json
│ ├── java/
│ │ └── com/
│ │ └── android/
│ │ └── media/
│ │ ├── DownloadBaseListActivity.java
│ │ ├── DownloadFeatureActivity.java
│ │ ├── DownloadOrcodeActivity.java
│ │ ├── DownloadPlayActivity.java
│ │ ├── DownloadSettingsActivity.java
│ │ ├── MainActivity.java
│ │ ├── MediaScannerActivity.java
│ │ ├── MyApplication.java
│ │ ├── PlayFeatureActivity.java
│ │ ├── PlayerActivity.java
│ │ └── VideoListAdapter.java
│ └── res/
│ ├── drawable/
│ │ ├── border.xml
│ │ └── ic_launcher_background.xml
│ ├── drawable-v24/
│ │ └── ic_launcher_foreground.xml
│ ├── layout/
│ │ ├── activity_download_feature.xml
│ │ ├── activity_download_list.xml
│ │ ├── activity_download_play.xml
│ │ ├── activity_download_settings.xml
│ │ ├── activity_main.xml
│ │ ├── activity_orcode.xml
│ │ ├── activity_play_func.xml
│ │ ├── activity_player.xml
│ │ ├── activity_scanner.xml
│ │ ├── download_item.xml
│ │ └── video_item.xml
│ ├── mipmap-anydpi-v26/
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ └── values/
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── base/
│ ├── .gitignore
│ ├── base.iml
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── android/
│ │ └── baselib/
│ │ ├── MediaSDKReceiver.java
│ │ ├── NetworkCallbackImpl.java
│ │ ├── NetworkListener.java
│ │ ├── WeakHandler.java
│ │ └── utils/
│ │ ├── LogUtils.java
│ │ ├── NetworkUtils.java
│ │ ├── ScreenUtils.java
│ │ └── Utility.java
│ └── res/
│ └── values/
│ └── strings.xml
├── build.gradle
├── constants.gradle
├── exoplayer/
│ ├── .gitignore
│ ├── build.gradle
│ ├── exoplayer.iml
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── google/
│ │ └── android/
│ │ └── exoplayer2/
│ │ ├── AudioBecomingNoisyManager.java
│ │ ├── AudioFocusManager.java
│ │ ├── BasePlayer.java
│ │ ├── BaseRenderer.java
│ │ ├── C.java
│ │ ├── ControlDispatcher.java
│ │ ├── DefaultControlDispatcher.java
│ │ ├── DefaultLoadControl.java
│ │ ├── DefaultMediaClock.java
│ │ ├── DefaultRenderersFactory.java
│ │ ├── ExoPlaybackException.java
│ │ ├── ExoPlayer.java
│ │ ├── ExoPlayerFactory.java
│ │ ├── ExoPlayerImpl.java
│ │ ├── ExoPlayerImplInternal.java
│ │ ├── ExoPlayerLibraryInfo.java
│ │ ├── Format.java
│ │ ├── FormatHolder.java
│ │ ├── IllegalSeekPositionException.java
│ │ ├── LoadControl.java
│ │ ├── MediaPeriodHolder.java
│ │ ├── MediaPeriodInfo.java
│ │ ├── MediaPeriodQueue.java
│ │ ├── NoSampleRenderer.java
│ │ ├── ParserException.java
│ │ ├── PlaybackInfo.java
│ │ ├── PlaybackParameters.java
│ │ ├── PlaybackPreparer.java
│ │ ├── Player.java
│ │ ├── PlayerMessage.java
│ │ ├── Renderer.java
│ │ ├── RendererCapabilities.java
│ │ ├── RendererConfiguration.java
│ │ ├── RenderersFactory.java
│ │ ├── SeekParameters.java
│ │ ├── SimpleExoPlayer.java
│ │ ├── Timeline.java
│ │ ├── WakeLockManager.java
│ │ ├── analytics/
│ │ │ ├── AnalyticsCollector.java
│ │ │ ├── AnalyticsListener.java
│ │ │ ├── DefaultAnalyticsListener.java
│ │ │ ├── DefaultPlaybackSessionManager.java
│ │ │ ├── PlaybackSessionManager.java
│ │ │ ├── PlaybackStats.java
│ │ │ ├── PlaybackStatsListener.java
│ │ │ └── package-info.java
│ │ ├── audio/
│ │ │ ├── Ac3Util.java
│ │ │ ├── Ac4Util.java
│ │ │ ├── AudioAttributes.java
│ │ │ ├── AudioCapabilities.java
│ │ │ ├── AudioCapabilitiesReceiver.java
│ │ │ ├── AudioDecoderException.java
│ │ │ ├── AudioListener.java
│ │ │ ├── AudioProcessor.java
│ │ │ ├── AudioRendererEventListener.java
│ │ │ ├── AudioSink.java
│ │ │ ├── AudioTimestampPoller.java
│ │ │ ├── AudioTrackPositionTracker.java
│ │ │ ├── AuxEffectInfo.java
│ │ │ ├── BaseAudioProcessor.java
│ │ │ ├── ChannelMappingAudioProcessor.java
│ │ │ ├── DefaultAudioSink.java
│ │ │ ├── DtsUtil.java
│ │ │ ├── FloatResamplingAudioProcessor.java
│ │ │ ├── MediaCodecAudioRenderer.java
│ │ │ ├── ResamplingAudioProcessor.java
│ │ │ ├── SilenceSkippingAudioProcessor.java
│ │ │ ├── SimpleDecoderAudioRenderer.java
│ │ │ ├── Sonic.java
│ │ │ ├── SonicAudioProcessor.java
│ │ │ ├── TeeAudioProcessor.java
│ │ │ ├── TrimmingAudioProcessor.java
│ │ │ ├── WavUtil.java
│ │ │ └── package-info.java
│ │ ├── database/
│ │ │ ├── DatabaseIOException.java
│ │ │ ├── DatabaseProvider.java
│ │ │ ├── DefaultDatabaseProvider.java
│ │ │ ├── ExoDatabaseProvider.java
│ │ │ ├── VersionTable.java
│ │ │ └── package-info.java
│ │ ├── decoder/
│ │ │ ├── Buffer.java
│ │ │ ├── CryptoInfo.java
│ │ │ ├── Decoder.java
│ │ │ ├── DecoderCounters.java
│ │ │ ├── DecoderInputBuffer.java
│ │ │ ├── OutputBuffer.java
│ │ │ ├── SimpleDecoder.java
│ │ │ ├── SimpleOutputBuffer.java
│ │ │ └── package-info.java
│ │ ├── drm/
│ │ │ ├── ClearKeyUtil.java
│ │ │ ├── DecryptionException.java
│ │ │ ├── DefaultDrmSession.java
│ │ │ ├── DefaultDrmSessionEventListener.java
│ │ │ ├── DefaultDrmSessionManager.java
│ │ │ ├── DrmInitData.java
│ │ │ ├── DrmSession.java
│ │ │ ├── DrmSessionManager.java
│ │ │ ├── DummyExoMediaDrm.java
│ │ │ ├── ErrorStateDrmSession.java
│ │ │ ├── ExoMediaCrypto.java
│ │ │ ├── ExoMediaDrm.java
│ │ │ ├── FrameworkMediaCrypto.java
│ │ │ ├── FrameworkMediaDrm.java
│ │ │ ├── HttpMediaDrmCallback.java
│ │ │ ├── KeysExpiredException.java
│ │ │ ├── LocalMediaDrmCallback.java
│ │ │ ├── MediaDrmCallback.java
│ │ │ ├── OfflineLicenseHelper.java
│ │ │ ├── UnsupportedDrmException.java
│ │ │ ├── WidevineUtil.java
│ │ │ └── package-info.java
│ │ ├── extractor/
│ │ │ ├── BinarySearchSeeker.java
│ │ │ ├── ChunkIndex.java
│ │ │ ├── ConstantBitrateSeekMap.java
│ │ │ ├── DefaultExtractorInput.java
│ │ │ ├── DefaultExtractorsFactory.java
│ │ │ ├── DummyExtractorOutput.java
│ │ │ ├── DummyTrackOutput.java
│ │ │ ├── Extractor.java
│ │ │ ├── ExtractorInput.java
│ │ │ ├── ExtractorOutput.java
│ │ │ ├── ExtractorsFactory.java
│ │ │ ├── GaplessInfoHolder.java
│ │ │ ├── Id3Peeker.java
│ │ │ ├── MpegAudioHeader.java
│ │ │ ├── PositionHolder.java
│ │ │ ├── SeekMap.java
│ │ │ ├── SeekPoint.java
│ │ │ ├── TrackOutput.java
│ │ │ ├── amr/
│ │ │ │ └── AmrExtractor.java
│ │ │ ├── flv/
│ │ │ │ ├── AudioTagPayloadReader.java
│ │ │ │ ├── FlvExtractor.java
│ │ │ │ ├── ScriptTagPayloadReader.java
│ │ │ │ ├── TagPayloadReader.java
│ │ │ │ └── VideoTagPayloadReader.java
│ │ │ ├── mkv/
│ │ │ │ ├── DefaultEbmlReader.java
│ │ │ │ ├── EbmlProcessor.java
│ │ │ │ ├── EbmlReader.java
│ │ │ │ ├── MatroskaExtractor.java
│ │ │ │ ├── Sniffer.java
│ │ │ │ └── VarintReader.java
│ │ │ ├── mp3/
│ │ │ │ ├── ConstantBitrateSeeker.java
│ │ │ │ ├── MlltSeeker.java
│ │ │ │ ├── Mp3Extractor.java
│ │ │ │ ├── Seeker.java
│ │ │ │ ├── VbriSeeker.java
│ │ │ │ └── XingSeeker.java
│ │ │ ├── mp4/
│ │ │ │ ├── Atom.java
│ │ │ │ ├── AtomParsers.java
│ │ │ │ ├── DefaultSampleValues.java
│ │ │ │ ├── FixedSampleSizeRechunker.java
│ │ │ │ ├── FragmentedMp4Extractor.java
│ │ │ │ ├── MdtaMetadataEntry.java
│ │ │ │ ├── MetadataUtil.java
│ │ │ │ ├── Mp4Extractor.java
│ │ │ │ ├── PsshAtomUtil.java
│ │ │ │ ├── Sniffer.java
│ │ │ │ ├── Track.java
│ │ │ │ ├── TrackEncryptionBox.java
│ │ │ │ ├── TrackFragment.java
│ │ │ │ └── TrackSampleTable.java
│ │ │ ├── ogg/
│ │ │ │ ├── DefaultOggSeeker.java
│ │ │ │ ├── FlacReader.java
│ │ │ │ ├── OggExtractor.java
│ │ │ │ ├── OggPacket.java
│ │ │ │ ├── OggPageHeader.java
│ │ │ │ ├── OggSeeker.java
│ │ │ │ ├── OpusReader.java
│ │ │ │ ├── StreamReader.java
│ │ │ │ ├── VorbisBitArray.java
│ │ │ │ ├── VorbisReader.java
│ │ │ │ └── VorbisUtil.java
│ │ │ ├── rawcc/
│ │ │ │ └── RawCcExtractor.java
│ │ │ ├── ts/
│ │ │ │ ├── Ac3Extractor.java
│ │ │ │ ├── Ac3Reader.java
│ │ │ │ ├── Ac4Extractor.java
│ │ │ │ ├── Ac4Reader.java
│ │ │ │ ├── AdtsExtractor.java
│ │ │ │ ├── AdtsReader.java
│ │ │ │ ├── DefaultTsPayloadReaderFactory.java
│ │ │ │ ├── DtsReader.java
│ │ │ │ ├── DvbSubtitleReader.java
│ │ │ │ ├── ElementaryStreamReader.java
│ │ │ │ ├── H262Reader.java
│ │ │ │ ├── H264Reader.java
│ │ │ │ ├── H265Reader.java
│ │ │ │ ├── Id3Reader.java
│ │ │ │ ├── LatmReader.java
│ │ │ │ ├── MpegAudioReader.java
│ │ │ │ ├── NalUnitTargetBuffer.java
│ │ │ │ ├── PesReader.java
│ │ │ │ ├── PsBinarySearchSeeker.java
│ │ │ │ ├── PsDurationReader.java
│ │ │ │ ├── PsExtractor.java
│ │ │ │ ├── SectionPayloadReader.java
│ │ │ │ ├── SectionReader.java
│ │ │ │ ├── SeiReader.java
│ │ │ │ ├── SpliceInfoSectionReader.java
│ │ │ │ ├── TsBinarySearchSeeker.java
│ │ │ │ ├── TsDurationReader.java
│ │ │ │ ├── TsExtractor.java
│ │ │ │ ├── TsPayloadReader.java
│ │ │ │ ├── TsUtil.java
│ │ │ │ └── UserDataReader.java
│ │ │ └── wav/
│ │ │ ├── WavExtractor.java
│ │ │ ├── WavHeader.java
│ │ │ └── WavHeaderReader.java
│ │ ├── mediacodec/
│ │ │ ├── MediaCodecInfo.java
│ │ │ ├── MediaCodecRenderer.java
│ │ │ ├── MediaCodecSelector.java
│ │ │ ├── MediaCodecUtil.java
│ │ │ ├── MediaFormatUtil.java
│ │ │ └── package-info.java
│ │ ├── metadata/
│ │ │ ├── Metadata.java
│ │ │ ├── MetadataDecoder.java
│ │ │ ├── MetadataDecoderFactory.java
│ │ │ ├── MetadataInputBuffer.java
│ │ │ ├── MetadataOutput.java
│ │ │ ├── MetadataRenderer.java
│ │ │ ├── emsg/
│ │ │ │ ├── EventMessage.java
│ │ │ │ ├── EventMessageDecoder.java
│ │ │ │ ├── EventMessageEncoder.java
│ │ │ │ └── package-info.java
│ │ │ ├── flac/
│ │ │ │ ├── PictureFrame.java
│ │ │ │ ├── VorbisComment.java
│ │ │ │ └── package-info.java
│ │ │ ├── icy/
│ │ │ │ ├── IcyDecoder.java
│ │ │ │ ├── IcyHeaders.java
│ │ │ │ ├── IcyInfo.java
│ │ │ │ └── package-info.java
│ │ │ ├── id3/
│ │ │ │ ├── ApicFrame.java
│ │ │ │ ├── BinaryFrame.java
│ │ │ │ ├── ChapterFrame.java
│ │ │ │ ├── ChapterTocFrame.java
│ │ │ │ ├── CommentFrame.java
│ │ │ │ ├── GeobFrame.java
│ │ │ │ ├── Id3Decoder.java
│ │ │ │ ├── Id3Frame.java
│ │ │ │ ├── InternalFrame.java
│ │ │ │ ├── MlltFrame.java
│ │ │ │ ├── PrivFrame.java
│ │ │ │ ├── TextInformationFrame.java
│ │ │ │ ├── UrlLinkFrame.java
│ │ │ │ └── package-info.java
│ │ │ ├── package-info.java
│ │ │ └── scte35/
│ │ │ ├── PrivateCommand.java
│ │ │ ├── SpliceCommand.java
│ │ │ ├── SpliceInfoDecoder.java
│ │ │ ├── SpliceInsertCommand.java
│ │ │ ├── SpliceNullCommand.java
│ │ │ ├── SpliceScheduleCommand.java
│ │ │ ├── TimeSignalCommand.java
│ │ │ └── package-info.java
│ │ ├── offline/
│ │ │ ├── ActionFile.java
│ │ │ ├── ActionFileUpgradeUtil.java
│ │ │ ├── DefaultDownloadIndex.java
│ │ │ ├── DefaultDownloaderFactory.java
│ │ │ ├── Download.java
│ │ │ ├── DownloadCursor.java
│ │ │ ├── DownloadException.java
│ │ │ ├── DownloadHelper.java
│ │ │ ├── DownloadIndex.java
│ │ │ ├── DownloadManager.java
│ │ │ ├── DownloadProgress.java
│ │ │ ├── DownloadRequest.java
│ │ │ ├── DownloadService.java
│ │ │ ├── Downloader.java
│ │ │ ├── DownloaderConstructorHelper.java
│ │ │ ├── DownloaderFactory.java
│ │ │ ├── FilterableManifest.java
│ │ │ ├── FilteringManifestParser.java
│ │ │ ├── ProgressiveDownloader.java
│ │ │ ├── SegmentDownloader.java
│ │ │ ├── StreamKey.java
│ │ │ ├── WritableDownloadIndex.java
│ │ │ └── package-info.java
│ │ ├── package-info.java
│ │ ├── scheduler/
│ │ │ ├── PlatformScheduler.java
│ │ │ ├── Requirements.java
│ │ │ ├── RequirementsWatcher.java
│ │ │ ├── Scheduler.java
│ │ │ └── package-info.java
│ │ ├── source/
│ │ │ ├── AbstractConcatenatedTimeline.java
│ │ │ ├── AdaptiveMediaSourceEventListener.java
│ │ │ ├── BaseMediaSource.java
│ │ │ ├── BehindLiveWindowException.java
│ │ │ ├── ClippingMediaPeriod.java
│ │ │ ├── ClippingMediaSource.java
│ │ │ ├── CompositeMediaSource.java
│ │ │ ├── CompositeSequenceableLoader.java
│ │ │ ├── CompositeSequenceableLoaderFactory.java
│ │ │ ├── ConcatenatingMediaSource.java
│ │ │ ├── DefaultCompositeSequenceableLoaderFactory.java
│ │ │ ├── DefaultMediaSourceEventListener.java
│ │ │ ├── EmptySampleStream.java
│ │ │ ├── ExtractorMediaSource.java
│ │ │ ├── ForwardingTimeline.java
│ │ │ ├── IcyDataSource.java
│ │ │ ├── LoopingMediaSource.java
│ │ │ ├── MaskingMediaPeriod.java
│ │ │ ├── MaskingMediaSource.java
│ │ │ ├── MediaPeriod.java
│ │ │ ├── MediaSource.java
│ │ │ ├── MediaSourceEventListener.java
│ │ │ ├── MediaSourceFactory.java
│ │ │ ├── MergingMediaPeriod.java
│ │ │ ├── MergingMediaSource.java
│ │ │ ├── ProgressiveMediaPeriod.java
│ │ │ ├── ProgressiveMediaSource.java
│ │ │ ├── SampleMetadataQueue.java
│ │ │ ├── SampleQueue.java
│ │ │ ├── SampleStream.java
│ │ │ ├── SequenceableLoader.java
│ │ │ ├── ShuffleOrder.java
│ │ │ ├── SilenceMediaSource.java
│ │ │ ├── SinglePeriodTimeline.java
│ │ │ ├── SingleSampleMediaPeriod.java
│ │ │ ├── SingleSampleMediaSource.java
│ │ │ ├── TrackGroup.java
│ │ │ ├── TrackGroupArray.java
│ │ │ ├── UnrecognizedInputFormatException.java
│ │ │ ├── ads/
│ │ │ │ ├── AdPlaybackState.java
│ │ │ │ ├── AdsLoader.java
│ │ │ │ ├── AdsMediaSource.java
│ │ │ │ └── SinglePeriodAdTimeline.java
│ │ │ ├── chunk/
│ │ │ │ ├── BaseMediaChunk.java
│ │ │ │ ├── BaseMediaChunkIterator.java
│ │ │ │ ├── BaseMediaChunkOutput.java
│ │ │ │ ├── Chunk.java
│ │ │ │ ├── ChunkExtractorWrapper.java
│ │ │ │ ├── ChunkHolder.java
│ │ │ │ ├── ChunkSampleStream.java
│ │ │ │ ├── ChunkSource.java
│ │ │ │ ├── ContainerMediaChunk.java
│ │ │ │ ├── DataChunk.java
│ │ │ │ ├── InitializationChunk.java
│ │ │ │ ├── MediaChunk.java
│ │ │ │ ├── MediaChunkIterator.java
│ │ │ │ ├── MediaChunkListIterator.java
│ │ │ │ └── SingleSampleMediaChunk.java
│ │ │ ├── dash/
│ │ │ │ ├── DashChunkSource.java
│ │ │ │ ├── DashManifestStaleException.java
│ │ │ │ ├── DashMediaPeriod.java
│ │ │ │ ├── DashMediaSource.java
│ │ │ │ ├── DashSegmentIndex.java
│ │ │ │ ├── DashUtil.java
│ │ │ │ ├── DashWrappingSegmentIndex.java
│ │ │ │ ├── DefaultDashChunkSource.java
│ │ │ │ ├── EventSampleStream.java
│ │ │ │ ├── PlayerEmsgHandler.java
│ │ │ │ ├── manifest/
│ │ │ │ │ ├── AdaptationSet.java
│ │ │ │ │ ├── DashManifest.java
│ │ │ │ │ ├── DashManifestParser.java
│ │ │ │ │ ├── Descriptor.java
│ │ │ │ │ ├── EventStream.java
│ │ │ │ │ ├── Period.java
│ │ │ │ │ ├── ProgramInformation.java
│ │ │ │ │ ├── RangedUri.java
│ │ │ │ │ ├── Representation.java
│ │ │ │ │ ├── SegmentBase.java
│ │ │ │ │ ├── SingleSegmentIndex.java
│ │ │ │ │ ├── UrlTemplate.java
│ │ │ │ │ ├── UtcTimingElement.java
│ │ │ │ │ └── package-info.java
│ │ │ │ ├── offline/
│ │ │ │ │ ├── DashDownloader.java
│ │ │ │ │ └── package-info.java
│ │ │ │ └── package-info.java
│ │ │ ├── hls/
│ │ │ │ ├── Aes128DataSource.java
│ │ │ │ ├── DefaultHlsDataSourceFactory.java
│ │ │ │ ├── DefaultHlsExtractorFactory.java
│ │ │ │ ├── FullSegmentEncryptionKeyCache.java
│ │ │ │ ├── HlsChunkSource.java
│ │ │ │ ├── HlsDataSourceFactory.java
│ │ │ │ ├── HlsExtractorFactory.java
│ │ │ │ ├── HlsManifest.java
│ │ │ │ ├── HlsMediaChunk.java
│ │ │ │ ├── HlsMediaPeriod.java
│ │ │ │ ├── HlsMediaSource.java
│ │ │ │ ├── HlsSampleStream.java
│ │ │ │ ├── HlsSampleStreamWrapper.java
│ │ │ │ ├── HlsTrackMetadataEntry.java
│ │ │ │ ├── SampleQueueMappingException.java
│ │ │ │ ├── TimestampAdjusterProvider.java
│ │ │ │ ├── WebvttExtractor.java
│ │ │ │ ├── offline/
│ │ │ │ │ ├── HlsDownloader.java
│ │ │ │ │ └── package-info.java
│ │ │ │ ├── package-info.java
│ │ │ │ └── playlist/
│ │ │ │ ├── DefaultHlsPlaylistParserFactory.java
│ │ │ │ ├── DefaultHlsPlaylistTracker.java
│ │ │ │ ├── FilteringHlsPlaylistParserFactory.java
│ │ │ │ ├── HlsMasterPlaylist.java
│ │ │ │ ├── HlsMediaPlaylist.java
│ │ │ │ ├── HlsPlaylist.java
│ │ │ │ ├── HlsPlaylistParser.java
│ │ │ │ ├── HlsPlaylistParserFactory.java
│ │ │ │ ├── HlsPlaylistTracker.java
│ │ │ │ └── package-info.java
│ │ │ └── smoothstreaming/
│ │ │ ├── DefaultSsChunkSource.java
│ │ │ ├── SsChunkSource.java
│ │ │ ├── SsMediaPeriod.java
│ │ │ ├── SsMediaSource.java
│ │ │ ├── manifest/
│ │ │ │ ├── SsManifest.java
│ │ │ │ ├── SsManifestParser.java
│ │ │ │ ├── SsUtil.java
│ │ │ │ └── package-info.java
│ │ │ ├── offline/
│ │ │ │ ├── SsDownloader.java
│ │ │ │ └── package-info.java
│ │ │ └── package-info.java
│ │ ├── text/
│ │ │ ├── CaptionStyleCompat.java
│ │ │ ├── Cue.java
│ │ │ ├── SimpleSubtitleDecoder.java
│ │ │ ├── SimpleSubtitleOutputBuffer.java
│ │ │ ├── Subtitle.java
│ │ │ ├── SubtitleDecoder.java
│ │ │ ├── SubtitleDecoderException.java
│ │ │ ├── SubtitleDecoderFactory.java
│ │ │ ├── SubtitleInputBuffer.java
│ │ │ ├── SubtitleOutputBuffer.java
│ │ │ ├── TextOutput.java
│ │ │ ├── TextRenderer.java
│ │ │ ├── cea/
│ │ │ │ ├── Cea608Decoder.java
│ │ │ │ ├── Cea708Cue.java
│ │ │ │ ├── Cea708Decoder.java
│ │ │ │ ├── Cea708InitializationData.java
│ │ │ │ ├── CeaDecoder.java
│ │ │ │ ├── CeaSubtitle.java
│ │ │ │ ├── CeaUtil.java
│ │ │ │ └── package-info.java
│ │ │ ├── dvb/
│ │ │ │ ├── DvbDecoder.java
│ │ │ │ ├── DvbParser.java
│ │ │ │ ├── DvbSubtitle.java
│ │ │ │ └── package-info.java
│ │ │ ├── package-info.java
│ │ │ ├── pgs/
│ │ │ │ ├── PgsDecoder.java
│ │ │ │ ├── PgsSubtitle.java
│ │ │ │ └── package-info.java
│ │ │ ├── ssa/
│ │ │ │ ├── SsaDecoder.java
│ │ │ │ ├── SsaDialogueFormat.java
│ │ │ │ ├── SsaStyle.java
│ │ │ │ ├── SsaSubtitle.java
│ │ │ │ └── package-info.java
│ │ │ ├── subrip/
│ │ │ │ ├── SubripDecoder.java
│ │ │ │ ├── SubripSubtitle.java
│ │ │ │ └── package-info.java
│ │ │ ├── ttml/
│ │ │ │ ├── TtmlDecoder.java
│ │ │ │ ├── TtmlNode.java
│ │ │ │ ├── TtmlRegion.java
│ │ │ │ ├── TtmlRenderUtil.java
│ │ │ │ ├── TtmlStyle.java
│ │ │ │ ├── TtmlSubtitle.java
│ │ │ │ └── package-info.java
│ │ │ ├── tx3g/
│ │ │ │ ├── Tx3gDecoder.java
│ │ │ │ ├── Tx3gSubtitle.java
│ │ │ │ └── package-info.java
│ │ │ └── webvtt/
│ │ │ ├── CssParser.java
│ │ │ ├── Mp4WebvttDecoder.java
│ │ │ ├── Mp4WebvttSubtitle.java
│ │ │ ├── WebvttCssStyle.java
│ │ │ ├── WebvttCue.java
│ │ │ ├── WebvttCueParser.java
│ │ │ ├── WebvttDecoder.java
│ │ │ ├── WebvttParserUtil.java
│ │ │ ├── WebvttSubtitle.java
│ │ │ └── package-info.java
│ │ ├── trackselection/
│ │ │ ├── AdaptiveTrackSelection.java
│ │ │ ├── BaseTrackSelection.java
│ │ │ ├── BufferSizeAdaptationBuilder.java
│ │ │ ├── DefaultTrackSelector.java
│ │ │ ├── FixedTrackSelection.java
│ │ │ ├── MappingTrackSelector.java
│ │ │ ├── RandomTrackSelection.java
│ │ │ ├── TrackSelection.java
│ │ │ ├── TrackSelectionArray.java
│ │ │ ├── TrackSelectionParameters.java
│ │ │ ├── TrackSelectionUtil.java
│ │ │ ├── TrackSelector.java
│ │ │ ├── TrackSelectorResult.java
│ │ │ └── package-info.java
│ │ ├── upstream/
│ │ │ ├── Allocation.java
│ │ │ ├── Allocator.java
│ │ │ ├── AssetDataSource.java
│ │ │ ├── BandwidthMeter.java
│ │ │ ├── BaseDataSource.java
│ │ │ ├── ByteArrayDataSink.java
│ │ │ ├── ByteArrayDataSource.java
│ │ │ ├── ContentDataSource.java
│ │ │ ├── DataSchemeDataSource.java
│ │ │ ├── DataSink.java
│ │ │ ├── DataSource.java
│ │ │ ├── DataSourceException.java
│ │ │ ├── DataSourceInputStream.java
│ │ │ ├── DataSpec.java
│ │ │ ├── DefaultAllocator.java
│ │ │ ├── DefaultBandwidthMeter.java
│ │ │ ├── DefaultDataSource.java
│ │ │ ├── DefaultDataSourceFactory.java
│ │ │ ├── DefaultHttpDataSource.java
│ │ │ ├── DefaultHttpDataSourceFactory.java
│ │ │ ├── DefaultLoadErrorHandlingPolicy.java
│ │ │ ├── DummyDataSource.java
│ │ │ ├── FileDataSource.java
│ │ │ ├── FileDataSourceFactory.java
│ │ │ ├── HttpDataSource.java
│ │ │ ├── LoadErrorHandlingPolicy.java
│ │ │ ├── Loader.java
│ │ │ ├── LoaderErrorThrower.java
│ │ │ ├── ParsingLoadable.java
│ │ │ ├── PriorityDataSource.java
│ │ │ ├── PriorityDataSourceFactory.java
│ │ │ ├── RawResourceDataSource.java
│ │ │ ├── ResolvingDataSource.java
│ │ │ ├── StatsDataSource.java
│ │ │ ├── TeeDataSource.java
│ │ │ ├── TransferListener.java
│ │ │ ├── UdpDataSource.java
│ │ │ ├── cache/
│ │ │ │ ├── Cache.java
│ │ │ │ ├── CacheDataSink.java
│ │ │ │ ├── CacheDataSinkFactory.java
│ │ │ │ ├── CacheDataSource.java
│ │ │ │ ├── CacheDataSourceFactory.java
│ │ │ │ ├── CacheEvictor.java
│ │ │ │ ├── CacheFileMetadata.java
│ │ │ │ ├── CacheFileMetadataIndex.java
│ │ │ │ ├── CacheKeyFactory.java
│ │ │ │ ├── CacheSpan.java
│ │ │ │ ├── CacheUtil.java
│ │ │ │ ├── CachedContent.java
│ │ │ │ ├── CachedContentIndex.java
│ │ │ │ ├── CachedRegionTracker.java
│ │ │ │ ├── ContentMetadata.java
│ │ │ │ ├── ContentMetadataMutations.java
│ │ │ │ ├── DefaultContentMetadata.java
│ │ │ │ ├── LeastRecentlyUsedCacheEvictor.java
│ │ │ │ ├── NoOpCacheEvictor.java
│ │ │ │ ├── SimpleCache.java
│ │ │ │ └── SimpleCacheSpan.java
│ │ │ └── crypto/
│ │ │ ├── AesCipherDataSink.java
│ │ │ ├── AesCipherDataSource.java
│ │ │ ├── AesFlushingCipher.java
│ │ │ └── CryptoUtil.java
│ │ ├── util/
│ │ │ ├── Assertions.java
│ │ │ ├── AtomicFile.java
│ │ │ ├── Clock.java
│ │ │ ├── CodecSpecificDataUtil.java
│ │ │ ├── ColorParser.java
│ │ │ ├── ConditionVariable.java
│ │ │ ├── EGLSurfaceTexture.java
│ │ │ ├── ErrorMessageProvider.java
│ │ │ ├── EventDispatcher.java
│ │ │ ├── EventLogger.java
│ │ │ ├── FlacStreamMetadata.java
│ │ │ ├── GlUtil.java
│ │ │ ├── HandlerWrapper.java
│ │ │ ├── LibraryLoader.java
│ │ │ ├── Log.java
│ │ │ ├── LongArray.java
│ │ │ ├── MediaClock.java
│ │ │ ├── MimeTypes.java
│ │ │ ├── NalUnitUtil.java
│ │ │ ├── NonNullApi.java
│ │ │ ├── NotificationUtil.java
│ │ │ ├── ParsableBitArray.java
│ │ │ ├── ParsableByteArray.java
│ │ │ ├── ParsableNalUnitBitArray.java
│ │ │ ├── Predicate.java
│ │ │ ├── PriorityTaskManager.java
│ │ │ ├── RepeatModeUtil.java
│ │ │ ├── ReusableBufferedOutputStream.java
│ │ │ ├── SlidingPercentile.java
│ │ │ ├── StandaloneMediaClock.java
│ │ │ ├── SystemClock.java
│ │ │ ├── SystemHandlerWrapper.java
│ │ │ ├── TimedValueQueue.java
│ │ │ ├── TimestampAdjuster.java
│ │ │ ├── TraceUtil.java
│ │ │ ├── UriUtil.java
│ │ │ ├── Util.java
│ │ │ ├── XmlPullParserUtil.java
│ │ │ └── package-info.java
│ │ └── video/
│ │ ├── AvcConfig.java
│ │ ├── ColorInfo.java
│ │ ├── DolbyVisionConfig.java
│ │ ├── DummySurface.java
│ │ ├── HevcConfig.java
│ │ ├── MediaCodecVideoRenderer.java
│ │ ├── SimpleDecoderVideoRenderer.java
│ │ ├── VideoDecoderException.java
│ │ ├── VideoDecoderGLSurfaceView.java
│ │ ├── VideoDecoderInputBuffer.java
│ │ ├── VideoDecoderOutputBuffer.java
│ │ ├── VideoDecoderOutputBufferRenderer.java
│ │ ├── VideoDecoderRenderer.java
│ │ ├── VideoFrameMetadataListener.java
│ │ ├── VideoFrameReleaseTimeHelper.java
│ │ ├── VideoListener.java
│ │ ├── VideoRendererEventListener.java
│ │ ├── package-info.java
│ │ └── spherical/
│ │ ├── CameraMotionListener.java
│ │ ├── CameraMotionRenderer.java
│ │ ├── FrameRotationQueue.java
│ │ ├── Projection.java
│ │ ├── ProjectionDecoder.java
│ │ └── package-info.java
│ └── res/
│ └── values/
│ └── strings.xml
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── ijkplayer/
│ ├── .gitignore
│ ├── build.gradle
│ ├── ijkplayer.iml
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── tv/
│ │ └── danmaku/
│ │ └── ijk/
│ │ └── media/
│ │ └── player/
│ │ ├── AbstractMediaPlayer.java
│ │ ├── AndroidMediaPlayer.java
│ │ ├── IMediaPlayer.java
│ │ ├── ISurfaceTextureHolder.java
│ │ ├── ISurfaceTextureHost.java
│ │ ├── IjkLibLoader.java
│ │ ├── IjkMediaCodecInfo.java
│ │ ├── IjkMediaMeta.java
│ │ ├── IjkMediaPlayer.java
│ │ ├── IjkTimedText.java
│ │ ├── MediaInfo.java
│ │ ├── MediaPlayerProxy.java
│ │ ├── TextureMediaPlayer.java
│ │ ├── annotations/
│ │ │ ├── AccessedByNative.java
│ │ │ └── CalledByNative.java
│ │ ├── exceptions/
│ │ │ └── IjkMediaException.java
│ │ ├── ffmpeg/
│ │ │ └── FFmpegApi.java
│ │ ├── misc/
│ │ │ ├── AndroidMediaFormat.java
│ │ │ ├── AndroidTrackInfo.java
│ │ │ ├── IAndroidIO.java
│ │ │ ├── IMediaDataSource.java
│ │ │ ├── IMediaFormat.java
│ │ │ ├── ITrackInfo.java
│ │ │ ├── IjkMediaFormat.java
│ │ │ └── IjkTrackInfo.java
│ │ └── pragma/
│ │ ├── DebugLog.java
│ │ └── Pragma.java
│ └── res/
│ └── values/
│ └── strings.xml
├── mediaproxy/
│ ├── .gitignore
│ ├── build.gradle
│ ├── mediaproxy.iml
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── media/
│ │ └── cache/
│ │ ├── CacheManager.java
│ │ ├── DownloadConstants.java
│ │ ├── LocalProxyConfig.java
│ │ ├── StorageManager.java
│ │ ├── VideoCacheException.java
│ │ ├── VideoDownloadManager.java
│ │ ├── VideoDownloadQueue.java
│ │ ├── VideoInfoParserManager.java
│ │ ├── download/
│ │ │ ├── BaseVideoDownloadTask.java
│ │ │ ├── M3U8VideoDownloadTask.java
│ │ │ └── VideoDownloadTask.java
│ │ ├── hls/
│ │ │ ├── M3U8.java
│ │ │ ├── M3U8Constants.java
│ │ │ ├── M3U8Ts.java
│ │ │ └── M3U8Utils.java
│ │ ├── http/
│ │ │ ├── ChunkedOutputStream.java
│ │ │ ├── ContentType.java
│ │ │ ├── HttpRequest.java
│ │ │ ├── HttpResponse.java
│ │ │ ├── IState.java
│ │ │ ├── Method.java
│ │ │ ├── ResponseState.java
│ │ │ └── SocketProcessorTask.java
│ │ ├── listener/
│ │ │ ├── IDownloadInfosCallback.java
│ │ │ ├── IDownloadListener.java
│ │ │ ├── IDownloadTaskListener.java
│ │ │ ├── IVideoInfoCallback.java
│ │ │ └── IVideoInfoParseCallback.java
│ │ ├── model/
│ │ │ ├── Video.java
│ │ │ ├── VideoCacheInfo.java
│ │ │ ├── VideoTaskItem.java
│ │ │ ├── VideoTaskMode.java
│ │ │ └── VideoTaskState.java
│ │ ├── proxy/
│ │ │ ├── AsyncProxyServer.java
│ │ │ └── CustomProxyServer.java
│ │ └── utils/
│ │ ├── DownloadExceptionUtils.java
│ │ ├── HttpUtils.java
│ │ ├── LocalProxyThreadUtils.java
│ │ ├── LocalProxyUtils.java
│ │ └── StorageUtils.java
│ └── res/
│ └── values/
│ └── strings.xml
├── playersdk/
│ ├── .gitignore
│ ├── build.gradle
│ ├── playersdk.iml
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── android/
│ │ └── player/
│ │ ├── CommonPlayer.java
│ │ ├── IPlayer.java
│ │ ├── PlayerAttributes.java
│ │ ├── PlayerType.java
│ │ ├── impl/
│ │ │ ├── ExoPlayerImpl.java
│ │ │ ├── IjkPlayerImpl.java
│ │ │ ├── MediaPlayerImpl.java
│ │ │ └── PlayerImpl.java
│ │ └── proxy/
│ │ └── LocalProxyPlayerImpl.java
│ └── res/
│ └── values/
│ └── strings.xml
└── settings.gradle
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
build
.gradle
.idea
local.properties
app/app.iml
playerlib/playerlib.iml
exoplayerlib/exoplayerlib.iml
ijkplayerlib/ijkplayerlib.iml
mediaproxylib/mediaproxylib.iml
mediaproxylib/build
mediaproxylib/build/*
/MediaSDK.iml
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2014-2016 Alexey Danilov
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.
================================================
FILE: README.md
================================================
# MediaSDK
The library is working for downloading video while playing the video, the video contains M3U8/MP4 <br>
Developer documentation is here, [Click it](./README_cn.md)<br>
You can refer to the technical documentation:https://www.jianshu.com/p/27085da32a35 <br>
Use the library: <br>
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.JeffMony:MediaSDK:2.0.0'
}
```
#### The Core functions of the project
> * Cache management, LRU
> * Video downloading management
> * Local proxy management
> * Display downloading speed
> * Display the video cache's size
> * Support the video's downloading while playing the video, M3U8/MP4 video
The project's architecture is as follows:

### Developer documentation
#### 1.Application->onCreate(...)
```
File file = LocalProxyUtils.getVideoCacheDir(this);
if (!file.exists()) {
file.mkdir();
}
LocalProxyConfig config = new VideoDownloadManager.Build(this)
.setCacheRoot(file)
.setUrlRedirect(false)
.setTimeOut(DownloadConstants.READ_TIMEOUT, DownloadConstants.CONN_TIMEOUT, DownloadConstants.SOCKET_TIMEOUT)
.setConcurrentCount(DownloadConstants.CONCURRENT_COUNT)
.setIgnoreAllCertErrors(true)
.buildConfig();
VideoDownloadManager.getInstance().initConfig(config);
```
1.setCacheRoot The cache path;
2.setUrlRedirect Support request's redirect;
3.setCacheSize Set cache size;
4.setTimeOut Set request's timeout;
5.setPort Set the local proxy server's port;
6.setIgnoreAllCertErrors Support the certificate;
#### 2.The local proxy server's switch
```
PlayerAttributes attributes = new PlayerAttributes();
attributes.setUseLocalProxy(mUseLocalProxy);
```
#### 3.Set the listener
```
mPlayer.setOnLocalProxyCacheListener(mOnLocalProxyCacheListener);
mPlayer.startLocalProxy(mUrl, null);
private IPlayer.OnLocalProxyCacheListener mOnLocalProxyCacheListener = new IPlayer.OnLocalProxyCacheListener() {
@Override
public void onCacheReady(IPlayer mp, String proxyUrl) {
LogUtils.w("onCacheReady proxyUrl = " + proxyUrl);
Uri uri = Uri.parse(proxyUrl);
try {
mPlayer.setDataSource(PlayerActivity.this, uri);
} catch (IOException e) {
e.printStackTrace();
return;
}
mPlayer.setSurface(mSurface);
mPlayer.setOnPreparedListener(mPreparedListener);
mPlayer.setOnVideoSizeChangedListener(mVideoSizeChangeListener);
mPlayer.prepareAsync();
}
@Override
public void onCacheProgressChanged(IPlayer mp, int percent, long cachedSize) {
LogUtils.w("onCacheProgressChanged percent = " + percent);
mPercent = percent;
}
@Override
public void onCacheSpeedChanged(String url, float cacheSpeed) {
if (mPlayer != null && mPlayer.get() != null) {
mPlayer.get().notifyProxyCacheSpeed(cacheSpeed);
}
}
@Override
public void onCacheFinished(String url) {
LogUtils.i("onCacheFinished url="+url + ", player="+this);
mIsCompleteCached = true;
}
@Override
public void onCacheForbidden(String url) {
LogUtils.w("onCacheForbidden url="+url+", player="+this);
mUseLocalProxy = false;
if (mPlayer != null && mPlayer.get() != null) {
mPlayer.get().notifyProxyCacheForbidden(url);
}
}
@Override
public void onCacheFailed(String url, Exception e) {
LogUtils.w("onCacheFailed , player="+this);
pauseProxyCacheTask(PROXY_CACHE_EXCEPTION);
}
};
```
demo:<br>



================================================
FILE: README_cn.md
================================================
# MediaSDK
关注一下分析文章:https://www.jianshu.com/p/27085da32a35
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.JeffMony:MediaSDK:2.0.0'
}
```
最近这个项目有新的维护计划:
> * 1.本地代理的控制逻辑移到server端
> * 2.增加mp4 moov端的识别规则
> * 3.将本地代理库和播放器解耦
### 版本LOG
2.0.0
> * 1.使用androidasync替换proxyserver
> * 2.优化MediaSDK接口
t1.5.0
> * 1.视频下载队列,可以设置视频并发下载的个数
> * 2.视频播放缓存和下载缓存的数据合并,但是逻辑分离
t1.4.0
> * 1.增加视频下载模块;
> * 2.重构本地代理模块代码;
> * 3.视频下载和本地代理模块代码复用;
> * 4.还有一些bug待处理,很快更新
> * 5.后续版本更新计划: 下载队列;初始化本地已下载的视频;下载和播放缓存隔离;
t1.3.0
> * 1.封装好边下边播模块
> * 2.可以直接商用
v1.1.0
> * 1.解决https 证书出错的视频url请求,信任证书;
> * 2.解决播放过程中息屏的问题,保持屏幕常亮;
> * 3.增加 isPlaying 接口,表示当前是否正在播放视频;
> * 4.解决Cleartext HTTP traffic to 127.0.0.1 not permitted 问题,Android P版本不允许未加密请求;
v1.0.0
> * 1.支持MediaPlayer/IjkPlayer/ExoPlayer 三种播放器播放视频;
> * 2.支持M3U8/MP4视频的边下边播功能;
> * 3.本地代理实现边下边播功能;
> * 4.提供当前下载速度和下载进度的回调;
#### 封装了一个播放器功能库
> * 实现ijkplayer exoplayer mediaplayer 3种播放器类型;可以任意切换;
> * ijkplayer 是从 k0.8.8分支上拉出来的;
> * exoplayer 是 2.11.1版本
#### 实现视频边下边播的功能
> * 缓存管理
> * 下载管理
> * 本地代理管理模块(使用androidasync管理本地代理)
> * 回调播放下载实时速度
> * 显示缓存大小
本项目的架构如下:

从上面的架构可以看出来,本项目的重点在本地代理层,这是实现边下边播的核心逻辑;
### 接入库须知
#### 1.在Application->onCreate(...) 中初始化
```
File file = LocalProxyUtils.getVideoCacheDir(this);
if (!file.exists()) {
file.mkdir();
}
LocalProxyConfig config = new VideoDownloadManager.Build(this)
.setCacheRoot(file)
.setUrlRedirect(false)
.setTimeOut(DownloadConstants.READ_TIMEOUT, DownloadConstants.CONN_TIMEOUT, DownloadConstants.SOCKET_TIMEOUT)
.setConcurrentCount(DownloadConstants.CONCURRENT_COUNT)
.setIgnoreAllCertErrors(true)
.buildConfig();
VideoDownloadManager.getInstance().initConfig(config);
```
这儿可以设置一些属性:
1.setCacheRoot 设置缓存的路径;
2.setUrlRedirect 是否需要重定向请求;
3.setCacheSize 设置缓存的大小限制;
4.setTimeOut 设置连接和读超时时间;
5.setPort 设置本地代理的端口;
6.setIgnoreAllCertErrors 是否需要信任证书;
#### 2.打开本地代理开关
```
PlayerAttributes attributes = new PlayerAttributes();
attributes.setUseLocalProxy(mUseLocalProxy);
```
#### 3.设置本地代理模块监听
```
mPlayer.setOnLocalProxyCacheListener(mOnLocalProxyCacheListener);
mPlayer.startLocalProxy(mUrl, null);
private IPlayer.OnLocalProxyCacheListener mOnLocalProxyCacheListener = new IPlayer.OnLocalProxyCacheListener() {
@Override
public void onCacheReady(IPlayer mp, String proxyUrl) {
LogUtils.w("onCacheReady proxyUrl = " + proxyUrl);
Uri uri = Uri.parse(proxyUrl);
try {
mPlayer.setDataSource(PlayerActivity.this, uri);
} catch (IOException e) {
e.printStackTrace();
return;
}
mPlayer.setSurface(mSurface);
mPlayer.setOnPreparedListener(mPreparedListener);
mPlayer.setOnVideoSizeChangedListener(mVideoSizeChangeListener);
mPlayer.prepareAsync();
}
@Override
public void onCacheProgressChanged(IPlayer mp, int percent, long cachedSize) {
LogUtils.w("onCacheProgressChanged percent = " + percent);
mPercent = percent;
}
@Override
public void onCacheSpeedChanged(String url, float cacheSpeed) {
if (mPlayer != null && mPlayer.get() != null) {
mPlayer.get().notifyProxyCacheSpeed(cacheSpeed);
}
}
@Override
public void onCacheFinished(String url) {
LogUtils.i("onCacheFinished url="+url + ", player="+this);
mIsCompleteCached = true;
}
@Override
public void onCacheForbidden(String url) {
LogUtils.w("onCacheForbidden url="+url+", player="+this);
mUseLocalProxy = false;
if (mPlayer != null && mPlayer.get() != null) {
mPlayer.get().notifyProxyCacheForbidden(url);
}
}
@Override
public void onCacheFailed(String url, Exception e) {
LogUtils.w("onCacheFailed , player="+this);
pauseProxyCacheTask(PROXY_CACHE_EXCEPTION);
}
};
```
#### 4.本地代理的生命周期跟着播放器的生命周期一起
#### 5.下载接入函数
```
public interface IDownloadListener {
void onDownloadPrepare(VideoTaskItem item);
void onDownloadPending(VideoTaskItem item);
void onDownloadStart(VideoTaskItem item);
void onDownloadProxyReady(VideoTaskItem item);
void onDownloadProgress(VideoTaskItem item);
void onDownloadSpeed(VideoTaskItem item);
void onDownloadPause(VideoTaskItem item);
void onDownloadError(VideoTaskItem item);
void onDownloadProxyForbidden(VideoTaskItem item);
void onDownloadSuccess(VideoTaskItem item);
}
```
### 功能概要
#### 1.封装了一个player sdk层
> * 1.1 接入Android 原生的 MediaPlayer 播放器
> * 1.2 接入google的EXO player 播放器
> * 1.3 接入开源的 ijk player 播放器
#### 2.实现整视频的边下边播
> * 2.1 实现整视频的分片下载
> * 2.2 实现整视频的断点下载
#### 3.实现HLS分片视频的边下边播
> * 3.1 实现HLS视频源的解析工作
> * 3.2 实现HLS的边下边播
> * 3.3 实现HLS的断点下载功能
#### 4.线程池控制下载功能
#### 5.提供视频下载的额外功能
> * 5.1 可以提供播放视频或者下载视频的实时网速
> * 5.2 可以提供已缓存视频的大小
demo示意图:<br>

欢迎关注我的公众号JeffMony,我会持续为你带来音视频---算法---Android---python 方面的知识分享<br>

如果你觉得这个库有用,请鼓励一下吧;<br>

================================================
FILE: androidasync/.gitignore
================================================
/build
================================================
FILE: androidasync/androidasync.iml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":androidasync" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":androidasync" />
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" value="3.5.3" />
<option name="LAST_KNOWN_AGP_VERSION" value="3.5.3" />
</configuration>
</facet>
<facet type="android" name="Android">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks>
<task>generateDebugSources</task>
</afterSyncTasks>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="PROJECT_TYPE" value="1" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/build/intermediates/javac/debug/classes" />
<output-test url="file://$MODULE_DIR$/build/intermediates/javac/debugUnitTest/classes" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debug/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debug/compileDebugAidl/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debug/compileDebugRenderscript/out" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/debug" type="java-resource" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugAndroidTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/aidl_source_output_dir/debugAndroidTest/compileDebugAndroidTestAidl/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/renderscript_source_output_dir/debugAndroidTest/compileDebugAndroidTestRenderscript/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/resValues/androidTest/debug" type="java-test-resource" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/ap_generated_sources/debugUnitTest/out" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Gradle: org.bouncycastle:bcpkix-jdk15on:1.60@jar" level="project" />
<orderEntry type="library" name="Gradle: org.bouncycastle:bcprov-jdk15on:1.60@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.collection:collection:1.1.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-common:2.1.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.arch.core:core-common:2.1.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.annotation:annotation:1.1.0@jar" level="project" />
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.fragment:fragment:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.appcompat:appcompat-resources:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.drawerlayout:drawerlayout:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.viewpager:viewpager:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.loader:loader:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.activity:activity:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable-animated:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.vectordrawable:vectordrawable:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.customview:customview:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.core:core:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.cursoradapter:cursoradapter:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.versionedparcelable:versionedparcelable:1.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-viewmodel:2.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-runtime:2.1.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.savedstate:savedstate:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.lifecycle:lifecycle-livedata-core:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.interpolator:interpolator:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime:2.0.0@aar" level="project" />
</component>
</module>
================================================
FILE: androidasync/build.gradle
================================================
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
consumerProguardFiles 'consumer-rules.pro'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compileOnly group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.60'
compileOnly group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version: '1.60'
implementation 'androidx.appcompat:appcompat:1.1.0'
}
================================================
FILE: androidasync/consumer-rules.pro
================================================
================================================
FILE: androidasync/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
================================================
FILE: androidasync/src/main/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jeffmony.async" />
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncDatagramSocket.java
================================================
package com.jeffmony.async;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
public class AsyncDatagramSocket extends AsyncNetworkSocket {
public void disconnect() throws IOException {
socketAddress = null;
((DatagramChannelWrapper)getChannel()).disconnect();
}
@Override
public InetSocketAddress getRemoteAddress() {
if (isOpen())
return super.getRemoteAddress();
return ((DatagramChannelWrapper)getChannel()).getRemoteAddress();
}
public void connect(InetSocketAddress address) throws IOException {
socketAddress = address;
((DatagramChannelWrapper)getChannel()).mChannel.connect(address);
}
public void send(final String host, final int port, final ByteBuffer buffer) {
if (getServer().getAffinity() != Thread.currentThread()) {
getServer().run(new Runnable() {
@Override
public void run() {
send(host, port, buffer);
}
});
return;
}
try {
((DatagramChannelWrapper)getChannel()).mChannel.send(buffer, new InetSocketAddress(host, port));
}
catch (IOException e) {
// close();
// reportEndPending(e);
// reportClose(e);
}
}
public void send(final InetSocketAddress address, final ByteBuffer buffer) {
if (getServer().getAffinity() != Thread.currentThread()) {
getServer().run(new Runnable() {
@Override
public void run() {
send(address, buffer);
}
});
return;
}
try {
int sent = ((DatagramChannelWrapper)getChannel()).mChannel.send(buffer, new InetSocketAddress(address.getHostName(), address.getPort()));
}
catch (IOException e) {
// Log.e("SEND", "send error", e);
// close();
// reportEndPending(e);
// reportClose(e);
}
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncNetworkSocket.java
================================================
package com.jeffmony.async;
import android.util.Log;
import com.jeffmony.async.callback.CompletedCallback;
import com.jeffmony.async.callback.DataCallback;
import com.jeffmony.async.callback.WritableCallback;
import com.jeffmony.async.util.Allocator;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.CancelledKeyException;
import java.nio.channels.DatagramChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel;
public class AsyncNetworkSocket implements AsyncSocket {
AsyncNetworkSocket() {
}
@Override
public void end() {
mChannel.shutdownOutput();
}
public boolean isChunked() {
return mChannel.isChunked();
}
InetSocketAddress socketAddress;
void attach(SocketChannel channel, InetSocketAddress socketAddress) throws IOException {
this.socketAddress = socketAddress;
allocator = new Allocator();
mChannel = new SocketChannelWrapper(channel);
}
void attach(DatagramChannel channel) throws IOException {
mChannel = new DatagramChannelWrapper(channel);
// keep udp at roughly the mtu, which is 1540 or something
// letting it grow freaks out nio apparently.
allocator = new Allocator(8192);
}
ChannelWrapper getChannel() {
return mChannel;
}
public void onDataWritable() {
// assert mWriteableHandler != null;
if (!mChannel.isChunked()) {
// turn write off
mKey.interestOps(~SelectionKey.OP_WRITE & mKey.interestOps());
}
if (mWriteableHandler != null)
mWriteableHandler.onWriteable();
}
private ChannelWrapper mChannel;
private SelectionKey mKey;
private AsyncServer mServer;
void setup(AsyncServer server, SelectionKey key) {
mServer = server;
mKey = key;
}
@Override
public void write(final ByteBufferList list) {
if (mServer.getAffinity() != Thread.currentThread()) {
mServer.run(new Runnable() {
@Override
public void run() {
write(list);
}
});
return;
}
if (!mChannel.isConnected()) {
assert !mChannel.isChunked();
return;
}
try {
int before = list.remaining();
ByteBuffer[] arr = list.getAllArray();
mChannel.write(arr);
list.addAll(arr);
handleRemaining(list.remaining());
mServer.onDataSent(before - list.remaining());
}
catch (IOException e) {
closeInternal();
reportEndPending(e);
reportClose(e);
}
}
private void handleRemaining(int remaining) throws IOException {
if (!mKey.isValid())
throw new IOException(new CancelledKeyException());
if (remaining > 0) {
// chunked channels should not fail
assert !mChannel.isChunked();
// register for a write notification if a write fails
// turn write on
mKey.interestOps(SelectionKey.OP_WRITE | mKey.interestOps());
}
else {
// turn write off
mKey.interestOps(~SelectionKey.OP_WRITE & mKey.interestOps());
}
}
private ByteBufferList pending = new ByteBufferList();
// private ByteBuffer[] buffers = new ByteBuffer[8];
Allocator allocator;
int onReadable() {
spitPending();
// even if the socket is paused,
// it may end up getting a queued readable event if it is
// already in the selector's ready queue.
if (mPaused)
return 0;
int total = 0;
boolean closed = false;
// ByteBufferList.obtainArray(buffers, Math.min(Math.max(mToAlloc, 2 << 11), maxAlloc));
ByteBuffer b = allocator.allocate();
// keep track of the max mount read during this read cycle
// so we can be quicker about allocations during the next
// time this socket reads.
long read;
try {
read = mChannel.read(b);
}
catch (Exception e) {
read = -1;
closeInternal();
reportEndPending(e);
reportClose(e);
}
if (read < 0) {
closeInternal();
closed = true;
}
else {
total += read;
}
if (read > 0) {
allocator.track(read);
b.flip();
// for (int i = 0; i < buffers.length; i++) {
// ByteBuffer b = buffers[i];
// buffers[i] = null;
// b.flip();
// pending.add(b);
// }
pending.add(b);
Util.emitAllData(this, pending);
}
else {
ByteBufferList.reclaim(b);
}
if (closed) {
reportEndPending(null);
reportClose(null);
}
return total;
}
boolean closeReported;
protected void reportClose(Exception e) {
if (closeReported)
return;
closeReported = true;
if (mClosedHander != null) {
mClosedHander.onCompleted(e);
mClosedHander = null;
}
}
@Override
public void close() {
closeInternal();
reportClose(null);
}
private void closeInternal() {
mKey.cancel();
try {
mChannel.close();
}
catch (IOException e) {
}
}
WritableCallback mWriteableHandler;
@Override
public void setWriteableCallback(WritableCallback handler) {
mWriteableHandler = handler;
}
DataCallback mDataHandler;
@Override
public void setDataCallback(DataCallback callback) {
mDataHandler = callback;
}
@Override
public DataCallback getDataCallback() {
return mDataHandler;
}
CompletedCallback mClosedHander;
@Override
public void setClosedCallback(CompletedCallback handler) {
mClosedHander = handler;
}
@Override
public CompletedCallback getClosedCallback() {
return mClosedHander;
}
@Override
public WritableCallback getWriteableCallback() {
return mWriteableHandler;
}
void reportEnd(Exception e) {
if (mEndReported)
return;
mEndReported = true;
if (mCompletedCallback != null)
mCompletedCallback.onCompleted(e);
else if (e != null) {
Log.e("NIO", "Unhandled exception", e);
}
}
boolean mEndReported;
Exception mPendingEndException;
void reportEndPending(Exception e) {
if (pending.hasRemaining()) {
mPendingEndException = e;
return;
}
reportEnd(e);
}
private CompletedCallback mCompletedCallback;
@Override
public void setEndCallback(CompletedCallback callback) {
mCompletedCallback = callback;
}
@Override
public CompletedCallback getEndCallback() {
return mCompletedCallback;
}
@Override
public boolean isOpen() {
return mChannel.isConnected() && mKey.isValid();
}
boolean mPaused = false;
@Override
public void pause() {
if (mServer.getAffinity() != Thread.currentThread()) {
mServer.run(new Runnable() {
@Override
public void run() {
pause();
}
});
return;
}
if (mPaused)
return;
mPaused = true;
try {
mKey.interestOps(~SelectionKey.OP_READ & mKey.interestOps());
}
catch (Exception ex) {
}
}
private void spitPending() {
if (pending.hasRemaining()) {
Util.emitAllData(this, pending);
}
}
@Override
public void resume() {
if (mServer.getAffinity() != Thread.currentThread()) {
mServer.run(new Runnable() {
@Override
public void run() {
resume();
}
});
return;
}
if (!mPaused)
return;
mPaused = false;
try {
mKey.interestOps(SelectionKey.OP_READ | mKey.interestOps());
}
catch (Exception ex) {
}
spitPending();
if (!isOpen())
reportEndPending(mPendingEndException);
}
@Override
public boolean isPaused() {
return mPaused;
}
@Override
public AsyncServer getServer() {
return mServer;
}
public InetSocketAddress getRemoteAddress() {
return socketAddress;
}
public InetAddress getLocalAddress() {
return mChannel.getLocalAddress();
}
public int getLocalPort() {
return mChannel.getLocalPort();
}
public Object getSocket() {
return getChannel().getSocket();
}
@Override
public String charset() {
return null;
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncSSLException.java
================================================
package com.jeffmony.async;
public class AsyncSSLException extends Exception {
public AsyncSSLException(Throwable cause) {
super("Peer not trusted by any of the system trust managers.", cause);
}
private boolean mIgnore = false;
public void setIgnore(boolean ignore) {
mIgnore = ignore;
}
public boolean getIgnore() {
return mIgnore;
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncSSLServerSocket.java
================================================
package com.jeffmony.async;
import java.security.PrivateKey;
import java.security.cert.Certificate;
public interface AsyncSSLServerSocket extends AsyncServerSocket {
PrivateKey getPrivateKey();
Certificate getCertificate();
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncSSLSocket.java
================================================
package com.jeffmony.async;
import java.security.cert.X509Certificate;
import javax.net.ssl.SSLEngine;
public interface AsyncSSLSocket extends AsyncSocket {
X509Certificate[] getPeerCertificates();
SSLEngine getSSLEngine();
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncSSLSocketWrapper.java
================================================
package com.jeffmony.async;
import android.content.Context;
import android.os.Build;
import android.util.Base64;
import android.util.Pair;
import com.jeffmony.async.callback.CompletedCallback;
import com.jeffmony.async.callback.ConnectCallback;
import com.jeffmony.async.callback.DataCallback;
import com.jeffmony.async.callback.ListenCallback;
import com.jeffmony.async.callback.WritableCallback;
import com.jeffmony.async.future.Cancellable;
import com.jeffmony.async.future.SimpleCancellable;
import com.jeffmony.async.http.SSLEngineSNIConfigurator;
import com.jeffmony.async.util.Allocator;
import com.jeffmony.async.util.StreamUtility;
import com.jeffmony.async.wrapper.AsyncSocketWrapper;
import org.apache.http.conn.ssl.StrictHostnameVerifier;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.asn1.x509.BasicConstraints;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.operator.ContentSigner;
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.math.BigInteger;
import java.net.InetAddress;
import java.nio.ByteBuffer;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.Provider;
import java.security.Security;
import java.security.cert.Certificate;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Calendar;
import java.util.Date;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLEngineResult;
import javax.net.ssl.SSLEngineResult.HandshakeStatus;
import javax.net.ssl.SSLEngineResult.Status;
import javax.net.ssl.SSLException;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
public class AsyncSSLSocketWrapper implements AsyncSocketWrapper, AsyncSSLSocket {
private static final String LOGTAG = "AsyncSSLSocketWrapper";
public interface HandshakeCallback {
public void onHandshakeCompleted(Exception e, AsyncSSLSocket socket);
}
static SSLContext defaultSSLContext;
static SSLContext trustAllSSLContext;
static TrustManager[] trustAllManagers;
static HostnameVerifier trustAllVerifier;
AsyncSocket mSocket;
BufferedDataSink mSink;
boolean mUnwrapping;
SSLEngine engine;
boolean finishedHandshake;
private int mPort;
private String mHost;
private boolean mWrapping;
HostnameVerifier hostnameVerifier;
HandshakeCallback handshakeCallback;
X509Certificate[] peerCertificates;
WritableCallback mWriteableCallback;
DataCallback mDataCallback;
TrustManager[] trustManagers;
boolean clientMode;
static {
// following is the "trust the system" certs setup
try {
// critical extension 2.5.29.15 is implemented improperly prior to 4.0.3.
// https://code.google.com/p/android/issues/detail?id=9307
// https://groups.google.com/forum/?fromgroups=#!topic/netty/UCfqPPk5O4s
// certs that use this extension will throw in Cipher.java.
// fallback is to use a custom SSLContext, and hack around the x509 extension.
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
throw new Exception();
defaultSSLContext = SSLContext.getInstance("Default");
}
catch (Exception ex) {
try {
defaultSSLContext = SSLContext.getInstance("TLS");
TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
for (X509Certificate cert : certs) {
if (cert != null && cert.getCriticalExtensionOIDs() != null)
cert.getCriticalExtensionOIDs().remove("2.5.29.15");
}
}
} };
defaultSSLContext.init(null, trustAllCerts, null);
}
catch (Exception ex2) {
ex.printStackTrace();
ex2.printStackTrace();
}
}
try {
trustAllSSLContext = SSLContext.getInstance("TLS");
trustAllManagers = new TrustManager[] { new X509TrustManager() {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
}
} };
trustAllSSLContext.init(null, trustAllManagers, null);
trustAllVerifier = (hostname, session) -> true;
}
catch (Exception ex2) {
ex2.printStackTrace();
}
}
public static SSLContext getDefaultSSLContext() {
return defaultSSLContext;
}
public static void handshake(AsyncSocket socket,
String host, int port,
SSLEngine sslEngine,
TrustManager[] trustManagers, HostnameVerifier verifier, boolean clientMode,
final HandshakeCallback callback) {
AsyncSSLSocketWrapper wrapper = new AsyncSSLSocketWrapper(socket, host, port, sslEngine, trustManagers, verifier, clientMode);
wrapper.handshakeCallback = callback;
socket.setClosedCallback(new CompletedCallback() {
@Override
public void onCompleted(Exception ex) {
if (ex != null)
callback.onHandshakeCompleted(ex, null);
else
callback.onHandshakeCompleted(new SSLException("socket closed during handshake"), null);
}
});
try {
wrapper.engine.beginHandshake();
wrapper.handleHandshakeStatus(wrapper.engine.getHandshakeStatus());
} catch (SSLException e) {
wrapper.report(e);
}
}
public static Cancellable connectSocket(AsyncServer server, String host, int port, ConnectCallback callback) {
return connectSocket(server, host, port, false, callback);
}
public static Cancellable connectSocket(AsyncServer server, String host, int port, boolean trustAllCerts, ConnectCallback callback) {
SimpleCancellable cancellable = new SimpleCancellable();
Cancellable connect = server.connectSocket(host, port, (ex, netSocket) -> {
if (ex != null) {
if (cancellable.setComplete())
callback.onConnectCompleted(ex, null);
return;
}
handshake(netSocket, host, port,
(trustAllCerts ? trustAllSSLContext : defaultSSLContext).createSSLEngine(host, port),
trustAllCerts ? trustAllManagers : null,
trustAllCerts ? trustAllVerifier : null,
true, (e, socket) -> {
if (!cancellable.setComplete()) {
if (socket != null)
socket.close();
return;
}
if (e != null)
callback.onConnectCompleted(e, null);
else
callback.onConnectCompleted(null, socket);
});
});
cancellable.setParent(connect);
return cancellable;
}
boolean mEnded;
Exception mEndException;
final ByteBufferList pending = new ByteBufferList();
private AsyncSSLSocketWrapper(AsyncSocket socket,
String host, int port,
SSLEngine sslEngine,
TrustManager[] trustManagers, HostnameVerifier verifier, boolean clientMode) {
mSocket = socket;
hostnameVerifier = verifier;
this.clientMode = clientMode;
this.trustManagers = trustManagers;
this.engine = sslEngine;
mHost = host;
mPort = port;
engine.setUseClientMode(clientMode);
mSink = new BufferedDataSink(socket);
mSink.setWriteableCallback(new WritableCallback() {
@Override
public void onWriteable() {
if (mWriteableCallback != null)
mWriteableCallback.onWriteable();
}
});
// on pause, the emitter is paused to prevent the buffered
// socket and itself from firing.
// on resume, emitter is resumed, ssl buffer is flushed as well
mSocket.setEndCallback(new CompletedCallback() {
@Override
public void onCompleted(Exception ex) {
if (mEnded)
return;
mEnded = true;
mEndException = ex;
if (!pending.hasRemaining() && mEndCallback != null)
mEndCallback.onCompleted(ex);
}
});
mSocket.setDataCallback(dataCallback);
}
final DataCallback dataCallback = new DataCallback() {
final Allocator allocator = new Allocator().setMinAlloc(8192);
final ByteBufferList buffered = new ByteBufferList();
@Override
public void onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
if (mUnwrapping)
return;
try {
mUnwrapping = true;
bb.get(buffered);
if (buffered.hasRemaining()) {
ByteBuffer all = buffered.getAll();
buffered.add(all);
}
ByteBuffer b = ByteBufferList.EMPTY_BYTEBUFFER;
while (true) {
if (b.remaining() == 0 && buffered.size() > 0) {
b = buffered.remove();
}
int remaining = b.remaining();
int before = pending.remaining();
SSLEngineResult res;
{
// wrap to prevent access to the readBuf
ByteBuffer readBuf = allocator.allocate();
res = engine.unwrap(b, readBuf);
addToPending(pending, readBuf);
allocator.track(pending.remaining() - before);
}
if (res.getStatus() == Status.BUFFER_OVERFLOW) {
allocator.setMinAlloc(allocator.getMinAlloc() * 2);
remaining = -1;
}
else if (res.getStatus() == Status.BUFFER_UNDERFLOW) {
buffered.addFirst(b);
if (buffered.size() <= 1) {
break;
}
// pack it
remaining = -1;
b = buffered.getAll();
buffered.addFirst(b);
b = ByteBufferList.EMPTY_BYTEBUFFER;
}
handleHandshakeStatus(res.getHandshakeStatus());
if (b.remaining() == remaining && before == pending.remaining()) {
buffered.addFirst(b);
break;
}
}
AsyncSSLSocketWrapper.this.onDataAvailable();
}
catch (SSLException ex) {
// ex.printStackTrace();
report(ex);
}
finally {
mUnwrapping = false;
}
}
};
public void onDataAvailable() {
Util.emitAllData(this, pending);
if (mEnded && !pending.hasRemaining() && mEndCallback != null)
mEndCallback.onCompleted(mEndException);
}
@Override
public SSLEngine getSSLEngine() {
return engine;
}
void addToPending(ByteBufferList out, ByteBuffer mReadTmp) {
mReadTmp.flip();
if (mReadTmp.hasRemaining()) {
out.add(mReadTmp);
}
else {
ByteBufferList.reclaim(mReadTmp);
}
}
@Override
public void end() {
mSocket.end();
}
public String getHost() {
return mHost;
}
public int getPort() {
return mPort;
}
private void handleHandshakeStatus(HandshakeStatus status) {
if (status == HandshakeStatus.NEED_TASK) {
final Runnable task = engine.getDelegatedTask();
task.run();
}
if (status == HandshakeStatus.NEED_WRAP) {
write(writeList);
}
if (status == HandshakeStatus.NEED_UNWRAP) {
dataCallback.onDataAvailable(this, new ByteBufferList());
}
try {
if (!finishedHandshake && (engine.getHandshakeStatus() == HandshakeStatus.NOT_HANDSHAKING || engine.getHandshakeStatus() == HandshakeStatus.FINISHED)) {
if (clientMode) {
Exception peerUnverifiedCause = null;
boolean trusted = false;
try {
peerCertificates = (X509Certificate[]) engine.getSession().getPeerCertificates();
if (mHost != null) {
if (hostnameVerifier == null) {
StrictHostnameVerifier verifier = new StrictHostnameVerifier();
verifier.verify(mHost, StrictHostnameVerifier.getCNs(peerCertificates[0]), StrictHostnameVerifier.getDNSSubjectAlts(peerCertificates[0]));
}
else {
if (!hostnameVerifier.verify(mHost, engine.getSession())) {
throw new SSLException("hostname <" + mHost + "> has been denied");
}
}
}
trusted = true;
}
catch (SSLException ex) {
peerUnverifiedCause = ex;
}
finishedHandshake = true;
if (!trusted) {
AsyncSSLException e = new AsyncSSLException(peerUnverifiedCause);
report(e);
if (!e.getIgnore())
throw e;
}
}
else {
finishedHandshake = true;
}
handshakeCallback.onHandshakeCompleted(null, this);
handshakeCallback = null;
mSocket.setClosedCallback(null);
// handshake can complete during a wrap, so make sure that the call
// stack and wrap flag is cleared before invoking writable
getServer().post(new Runnable() {
@Override
public void run() {
if (mWriteableCallback != null)
mWriteableCallback.onWriteable();
}
});
onDataAvailable();
}
}
catch (Exception ex) {
report(ex);
}
}
int calculateAlloc(int remaining) {
// alloc 50% more than we need for writing
int alloc = remaining * 3 / 2;
if (alloc == 0)
alloc = 8192;
return alloc;
}
ByteBufferList writeList = new ByteBufferList();
@Override
public void write(ByteBufferList bb) {
if (mWrapping)
return;
if (mSink.remaining() > 0)
return;
mWrapping = true;
int remaining;
SSLEngineResult res = null;
ByteBuffer writeBuf = ByteBufferList.obtain(calculateAlloc(bb.remaining()));
do {
// if the handshake is finished, don't send
// 0 bytes of data, since that makes the ssl connection die.
// it wraps a 0 byte package, and craps out.
if (finishedHandshake && bb.remaining() == 0)
break;
remaining = bb.remaining();
try {
ByteBuffer[] arr = bb.getAllArray();
res = engine.wrap(arr, writeBuf);
bb.addAll(arr);
writeBuf.flip();
writeList.add(writeBuf);
assert !writeList.hasRemaining();
if (writeList.remaining() > 0)
mSink.write(writeList);
int previousCapacity = writeBuf.capacity();
writeBuf = null;
if (res.getStatus() == Status.BUFFER_OVERFLOW) {
writeBuf = ByteBufferList.obtain(previousCapacity * 2);
remaining = -1;
}
else {
writeBuf = ByteBufferList.obtain(calculateAlloc(bb.remaining()));
handleHandshakeStatus(res.getHandshakeStatus());
}
}
catch (SSLException e) {
report(e);
}
}
while ((remaining != bb.remaining() || (res != null && res.getHandshakeStatus() == HandshakeStatus.NEED_WRAP)) && mSink.remaining() == 0);
mWrapping = false;
ByteBufferList.reclaim(writeBuf);
}
@Override
public void setWriteableCallback(WritableCallback handler) {
mWriteableCallback = handler;
}
@Override
public WritableCallback getWriteableCallback() {
return mWriteableCallback;
}
private void report(Exception e) {
final HandshakeCallback hs = handshakeCallback;
if (hs != null) {
handshakeCallback = null;
mSocket.setDataCallback(new DataCallback.NullDataCallback());
mSocket.end();
// handshake sets this callback. unset it.
mSocket.setClosedCallback(null);
mSocket.close();
hs.onHandshakeCompleted(e, null);
return;
}
CompletedCallback cb = getEndCallback();
if (cb != null)
cb.onCompleted(e);
}
@Override
public void setDataCallback(DataCallback callback) {
mDataCallback = callback;
}
@Override
public DataCallback getDataCallback() {
return mDataCallback;
}
@Override
public boolean isChunked() {
return mSocket.isChunked();
}
@Override
public boolean isOpen() {
return mSocket.isOpen();
}
@Override
public void close() {
mSocket.close();
}
@Override
public void setClosedCallback(CompletedCallback handler) {
mSocket.setClosedCallback(handler);
}
@Override
public CompletedCallback getClosedCallback() {
return mSocket.getClosedCallback();
}
CompletedCallback mEndCallback;
@Override
public void setEndCallback(CompletedCallback callback) {
mEndCallback = callback;
}
@Override
public CompletedCallback getEndCallback() {
return mEndCallback;
}
@Override
public void pause() {
mSocket.pause();
}
@Override
public void resume() {
mSocket.resume();
onDataAvailable();
}
@Override
public boolean isPaused() {
return mSocket.isPaused();
}
@Override
public AsyncServer getServer() {
return mSocket.getServer();
}
@Override
public AsyncSocket getSocket() {
return mSocket;
}
@Override
public DataEmitter getDataEmitter() {
return mSocket;
}
@Override
public X509Certificate[] getPeerCertificates() {
return peerCertificates;
}
@Override
public String charset() {
return null;
}
private static Certificate selfSign(KeyPair keyPair, String subjectDN) throws Exception
{
Provider bcProvider = new BouncyCastleProvider();
Security.addProvider(bcProvider);
long now = System.currentTimeMillis();
Date startDate = new Date(now);
X500Name dnName = new X500Name("CN=" + subjectDN);
BigInteger certSerialNumber = new BigInteger(Long.toString(now)); // <-- Using the current timestamp as the certificate serial number
Calendar calendar = Calendar.getInstance();
calendar.setTime(startDate);
calendar.add(Calendar.YEAR, 1); // <-- 1 Yr validity
Date endDate = calendar.getTime();
String signatureAlgorithm = "SHA256WithRSA"; // <-- Use appropriate signature algorithm based on your keyPair algorithm.
ContentSigner contentSigner = new JcaContentSignerBuilder(signatureAlgorithm).build(keyPair.getPrivate());
JcaX509v3CertificateBuilder certBuilder = new JcaX509v3CertificateBuilder(dnName, certSerialNumber, startDate, endDate, dnName, keyPair.getPublic());
// Extensions --------------------------
// Basic Constraints
BasicConstraints basicConstraints = new BasicConstraints(true); // <-- true for CA, false for EndEntity
certBuilder.addExtension(new ASN1ObjectIdentifier("2.5.29.19"), true, basicConstraints); // Basic Constraints is usually marked as critical.
// -------------------------------------
return new JcaX509CertificateConverter().setProvider(bcProvider).getCertificate(certBuilder.build(contentSigner));
}
public static Pair<KeyPair, Certificate> selfSignCertificate(final Context context, String subjectName) throws Exception {
File keyPath = context.getFileStreamPath(subjectName + "-key.txt");
KeyPair pair;
Certificate cert;
try {
String[] keyParts = StreamUtility.readFile(keyPath).split("\n");
X509EncodedKeySpec pub = new X509EncodedKeySpec(Base64.decode(keyParts[0], 0));
PKCS8EncodedKeySpec priv = new PKCS8EncodedKeySpec(Base64.decode(keyParts[1], 0));
cert = CertificateFactory.getInstance("X.509").generateCertificate(new ByteArrayInputStream(Base64.decode(keyParts[2], 0)));
KeyFactory fact = KeyFactory.getInstance("RSA");
pair = new KeyPair(fact.generatePublic(pub), fact.generatePrivate(priv));
}
catch (Exception e) {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
keyGen.initialize(2048);
pair = keyGen.generateKeyPair();
cert = selfSign(pair, subjectName);
StreamUtility.writeFile(keyPath,
Base64.encodeToString(pair.getPublic().getEncoded(), Base64.NO_WRAP)
+ "\n"
+ Base64.encodeToString(pair.getPrivate().getEncoded(), Base64.NO_WRAP)
+ "\n"
+ Base64.encodeToString(cert.getEncoded(), Base64.NO_WRAP));
}
return new Pair<>(pair, cert);
}
public static AsyncSSLServerSocket listenSecure(final Context context, final AsyncServer server, final String subjectName, final InetAddress host, final int port, final ListenCallback handler) {
final ObjectHolder<AsyncSSLServerSocket> holder = new ObjectHolder<>();
server.run(() -> {
try {
Pair<KeyPair, Certificate> keyCert = selfSignCertificate(context, subjectName);
KeyPair pair = keyCert.first;
Certificate cert = keyCert.second;
holder.held = listenSecure(server, pair.getPrivate(), cert, host, port, handler);
}
catch (Exception e) {
handler.onCompleted(e);
}
});
return holder.held;
}
public static AsyncSSLServerSocket listenSecure(AsyncServer server, String keyDer, String certDer, final InetAddress host, final int port, final ListenCallback handler) {
return listenSecure(server, Base64.decode(keyDer, Base64.DEFAULT), Base64.decode(certDer, Base64.DEFAULT), host, port, handler);
}
private static class ObjectHolder<T> {
T held;
}
public static AsyncSSLServerSocket listenSecure(final AsyncServer server, final byte[] keyDer, final byte[] certDer, final InetAddress host, final int port, final ListenCallback handler) {
final ObjectHolder<AsyncSSLServerSocket> holder = new ObjectHolder<>();
server.run(() -> {
try {
PKCS8EncodedKeySpec key = new PKCS8EncodedKeySpec(keyDer);
Certificate cert = CertificateFactory.getInstance("X.509").generateCertificate(new ByteArrayInputStream(certDer));
PrivateKey pk = KeyFactory.getInstance("RSA").generatePrivate(key);
holder.held = listenSecure(server, pk, cert, host, port, handler);
}
catch (Exception e) {
handler.onCompleted(e);
}
});
return holder.held;
}
public static AsyncSSLServerSocket listenSecure(final AsyncServer server, final PrivateKey pk, final Certificate cert, final InetAddress host, final int port, final ListenCallback handler) {
final ObjectHolder<AsyncSSLServerSocket> holder = new ObjectHolder<>();
server.run(() -> {
try {
KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(null);
ks.setKeyEntry("key", pk, null, new Certificate[] { cert });
KeyManagerFactory kmf = KeyManagerFactory.getInstance("X509");
kmf.init(ks, "".toCharArray());
TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(ks);
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
final AsyncServerSocket socket = listenSecure(server, sslContext, host, port, handler);
holder.held = new AsyncSSLServerSocket() {
@Override
public PrivateKey getPrivateKey() {
return pk;
}
@Override
public Certificate getCertificate() {
return cert;
}
@Override
public void stop() {
socket.stop();
}
@Override
public int getLocalPort() {
return socket.getLocalPort();
}
};
}
catch (Exception e) {
handler.onCompleted(e);
}
});
return holder.held;
}
public static AsyncServerSocket listenSecure(AsyncServer server, final SSLContext sslContext, final InetAddress host, final int port, final ListenCallback handler) {
final SSLEngineSNIConfigurator conf = new SSLEngineSNIConfigurator() {
@Override
public SSLEngine createEngine(SSLContext sslContext, String peerHost, int peerPort) {
SSLEngine engine = super.createEngine(sslContext, peerHost, peerPort);
// String[] ciphers = engine.getEnabledCipherSuites();
// for (String cipher: ciphers) {
// Log.i(LOGTAG, cipher);
// }
// todo: what's this for? some vestigal vysor code i think. required by audio mirroring?
engine.setEnabledCipherSuites(new String[] { "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" });
return engine;
}
};
return server.listen(host, port, new ListenCallback() {
@Override
public void onAccepted(final AsyncSocket socket) {
AsyncSSLSocketWrapper.handshake(socket, null, port, conf.createEngine(sslContext, null, port), null, null, false,
(e, sslSocket) -> {
if (e != null) {
// chrome seems to do some sort of SSL probe and cancels handshakes. not sure why.
// i suspect it is to pick an optimal strong cipher.
// seeing a lot of the following in the log (but no actual connection errors)
// javax.net.ssl.SSLHandshakeException: error:10000416:SSL routines:OPENSSL_internal:SSLV3_ALERT_CERTIFICATE_UNKNOWN
// seen on Shield TV running API 26
// todo fix: conscrypt ssl context?
// Log.e(LOGTAG, "Error while handshaking", e);
socket.close();
return;
}
handler.onAccepted(sslSocket);
});
}
@Override
public void onListening(AsyncServerSocket socket) {
handler.onListening(socket);
}
@Override
public void onCompleted(Exception ex) {
handler.onCompleted(ex);
}
});
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncSemaphore.java
================================================
package com.jeffmony.async;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
public class AsyncSemaphore {
Semaphore semaphore = new Semaphore(0);
public void acquire() throws InterruptedException {
ThreadQueue threadQueue = ThreadQueue.getOrCreateThreadQueue(Thread.currentThread());
AsyncSemaphore last = threadQueue.waiter;
threadQueue.waiter = this;
Semaphore queueSemaphore = threadQueue.queueSemaphore;
try {
if (semaphore.tryAcquire())
return;
while (true) {
// run the queue
while (true) {
Runnable run = threadQueue.remove();
if (run == null)
break;
// Log.i(LOGTAG, "Pumping for AsyncSemaphore");
run.run();
}
int permits = Math.max(1, queueSemaphore.availablePermits());
queueSemaphore.acquire(permits);
if (semaphore.tryAcquire())
break;
}
}
finally {
threadQueue.waiter = last;
}
}
public boolean tryAcquire(long timeout, TimeUnit timeunit) throws InterruptedException {
long timeoutMs = TimeUnit.MILLISECONDS.convert(timeout, timeunit);
ThreadQueue threadQueue = ThreadQueue.getOrCreateThreadQueue(Thread.currentThread());
AsyncSemaphore last = threadQueue.waiter;
threadQueue.waiter = this;
Semaphore queueSemaphore = threadQueue.queueSemaphore;
try {
if (semaphore.tryAcquire())
return true;
long start = System.currentTimeMillis();
do {
// run the queue
while (true) {
Runnable run = threadQueue.remove();
if (run == null)
break;
// Log.i(LOGTAG, "Pumping for AsyncSemaphore");
run.run();
}
int permits = Math.max(1, queueSemaphore.availablePermits());
if (!queueSemaphore.tryAcquire(permits, timeoutMs, TimeUnit.MILLISECONDS))
return false;
if (semaphore.tryAcquire())
return true;
}
while (System.currentTimeMillis() - start < timeoutMs);
return false;
}
finally {
threadQueue.waiter = last;
}
}
public void release() {
semaphore.release();
ThreadQueue.release(this);
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncServer.java
================================================
package com.jeffmony.async;
import android.os.Build;
import android.os.Handler;
import android.os.SystemClock;
import android.util.Log;
import com.jeffmony.async.callback.CompletedCallback;
import com.jeffmony.async.callback.ConnectCallback;
import com.jeffmony.async.callback.ListenCallback;
import com.jeffmony.async.callback.SocketCreateCallback;
import com.jeffmony.async.callback.ValueFunction;
import com.jeffmony.async.future.Cancellable;
import com.jeffmony.async.future.Future;
import com.jeffmony.async.future.FutureCallback;
import com.jeffmony.async.future.SimpleCancellable;
import com.jeffmony.async.future.SimpleFuture;
import com.jeffmony.async.util.StreamUtility;
import java.io.IOException;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.channels.CancelledKeyException;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.ClosedSelectorException;
import java.nio.channels.DatagramChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.nio.channels.spi.SelectorProvider;
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.Semaphore;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public class AsyncServer {
public static final String LOGTAG = "NIO";
private static class RunnableWrapper implements Runnable {
boolean hasRun;
Runnable runnable;
ThreadQueue threadQueue;
Handler handler;
@Override
public void run() {
synchronized (this) {
if (hasRun)
return;
hasRun = true;
}
try {
runnable.run();
}
finally {
threadQueue.remove(this);
handler.removeCallbacks(this);
threadQueue = null;
handler = null;
runnable = null;
}
}
}
public static void post(Handler handler, Runnable runnable) {
RunnableWrapper wrapper = new RunnableWrapper();
ThreadQueue threadQueue = ThreadQueue.getOrCreateThreadQueue(handler.getLooper().getThread());
wrapper.threadQueue = threadQueue;
wrapper.handler = handler;
wrapper.runnable = runnable;
// run it in a blocking AsyncSemaphore or a Handler, whichever gets to it first.
threadQueue.add(wrapper);
handler.post(wrapper);
// run the queue if the thread is blocking
threadQueue.queueSemaphore.release();
}
static {
try {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.FROYO) {
java.lang.System.setProperty("java.net.preferIPv4Stack", "true");
java.lang.System.setProperty("java.net.preferIPv6Addresses", "false");
}
}
catch (Throwable ex) {
}
}
static AsyncServer mInstance = new AsyncServer();
public static AsyncServer getDefault() {
return mInstance;
}
private SelectorWrapper mSelector;
public boolean isRunning() {
return mSelector != null;
}
String mName;
public AsyncServer() {
this(null);
}
public AsyncServer(String name) {
if (name == null)
name = "AsyncServer";
mName = name;
}
private static ExecutorService synchronousWorkers = newSynchronousWorkers("AsyncServer-worker-");
private static void wakeup(final SelectorWrapper selector) {
synchronousWorkers.execute(() -> {
try {
selector.wakeupOnce();
}
catch (Exception e) {
}
});
}
boolean killed;
public void kill() {
synchronized (this) {
killed = true;
}
stop(false);
}
int postCounter = 0;
public Cancellable postDelayed(Runnable runnable, long delay) {
Scheduled s;
synchronized (this) {
if (killed)
return SimpleCancellable.CANCELLED;
// Calculate when to run this queue item:
// If there is a delay (non-zero), add it to the current time
// When delay is zero, ensure that this follows all other
// zero-delay queue items. This is done by setting the
// "time" to the queue size. This will make sure it is before
// all time-delayed queue items (for all real world scenarios)
// as it will always be less than the current time and also remain
// behind all other immediately run queue items.
long time;
if (delay > 0)
time = SystemClock.elapsedRealtime() + delay;
else if (delay == 0)
time = postCounter++;
else if (mQueue.size() > 0)
time = Math.min(0, mQueue.peek().time - 1);
else
time = 0;
mQueue.add(s = new Scheduled(this, runnable, time));
// start the server up if necessary
if (mSelector == null)
run();
if (!isAffinityThread()) {
wakeup(mSelector);
}
}
return s;
}
public Cancellable postImmediate(Runnable runnable) {
if (Thread.currentThread() == getAffinity()) {
runnable.run();
return null;
}
return postDelayed(runnable, -1);
}
public Cancellable post(Runnable runnable) {
return postDelayed(runnable, 0);
}
public Cancellable post(final CompletedCallback callback, final Exception e) {
return post(() -> callback.onCompleted(e));
}
public void run(final Runnable runnable) {
if (Thread.currentThread() == mAffinity) {
post(runnable);
lockAndRunQueue(this, mQueue);
return;
}
final Semaphore semaphore;
synchronized (this) {
if (killed)
return;
semaphore = new Semaphore(0);
post(() -> {
runnable.run();
semaphore.release();
});
}
try {
semaphore.acquire();
}
catch (InterruptedException e) {
Log.e(LOGTAG, "run", e);
}
}
private static class Scheduled implements Cancellable, Runnable {
// this constructor is only called when the async execution should not be preserved
// ie... AsyncServer.stop.
public Scheduled(AsyncServer server, Runnable runnable, long time) {
this.server = server;
this.runnable = runnable;
this.time = time;
}
public AsyncServer server;
public Runnable runnable;
public long time;
@Override
public void run() {
this.runnable.run();
}
@Override
public boolean isDone() {
synchronized (server) {
return !cancelled && !server.mQueue.contains(this);
}
}
boolean cancelled;
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public boolean cancel() {
synchronized (server) {
return cancelled = server.mQueue.remove(this);
}
}
}
PriorityQueue<Scheduled> mQueue = new PriorityQueue<Scheduled>(1, Scheduler.INSTANCE);
static class Scheduler implements Comparator<Scheduled> {
public static Scheduler INSTANCE = new Scheduler();
private Scheduler() {
}
@Override
public int compare(Scheduled s1, Scheduled s2) {
// keep the smaller ones at the head, so they get tossed out quicker
if (s1.time == s2.time)
return 0;
if (s1.time > s2.time)
return 1;
return -1;
}
}
public void stop() {
stop(false);
}
public void stop(boolean wait) {
// Log.i(LOGTAG, "****AsyncServer is shutting down.****");
final SelectorWrapper currentSelector;
final Semaphore semaphore;
final boolean isAffinityThread;
synchronized (this) {
isAffinityThread = isAffinityThread();
currentSelector = mSelector;
if (currentSelector == null)
return;
semaphore = new Semaphore(0);
// post a shutdown and wait
mQueue.add(new Scheduled(this, new Runnable() {
@Override
public void run() {
shutdownEverything(currentSelector);
semaphore.release();
}
}, 0));
synchronousWorkers.execute(() -> {
try {
currentSelector.wakeupOnce();
}
catch (Exception e) {
}
});
// force any existing connections to die
shutdownKeys(currentSelector);
mQueue = new PriorityQueue<>(1, Scheduler.INSTANCE);
mSelector = null;
mAffinity = null;
}
try {
if (!isAffinityThread && wait)
semaphore.acquire();
}
catch (Exception e) {
}
}
protected void onDataReceived(int transmitted) {
}
protected void onDataSent(int transmitted) {
}
private static class ObjectHolder<T> {
T held;
}
public AsyncServerSocket listen(final InetAddress host, final int port, final ListenCallback handler) {
final ObjectHolder<AsyncServerSocket> holder = new ObjectHolder<>();
run(new Runnable() {
@Override
public void run() {
ServerSocketChannel closeableServer = null;
ServerSocketChannelWrapper closeableWrapper = null;
try {
closeableServer = ServerSocketChannel.open();
closeableWrapper = new ServerSocketChannelWrapper(
closeableServer);
final ServerSocketChannel server = closeableServer;
final ServerSocketChannelWrapper wrapper = closeableWrapper;
InetSocketAddress isa;
if (host == null)
isa = new InetSocketAddress(port);
else
isa = new InetSocketAddress(host, port);
server.socket().bind(isa);
final SelectionKey key = wrapper.register(mSelector.getSelector());
key.attach(handler);
handler.onListening(holder.held = new AsyncServerSocket() {
@Override
public int getLocalPort() {
return server.socket().getLocalPort();
}
@Override
public void stop() {
StreamUtility.closeQuietly(wrapper);
try {
key.cancel();
}
catch (Exception e) {
}
}
});
}
catch (IOException e) {
Log.e(LOGTAG, "wtf", e);
StreamUtility.closeQuietly(closeableWrapper, closeableServer);
handler.onCompleted(e);
}
}
});
return holder.held;
}
private class ConnectFuture extends SimpleFuture<AsyncNetworkSocket> {
@Override
protected void cancelCleanup() {
super.cancelCleanup();
try {
if (socket != null)
socket.close();
}
catch (IOException e) {
}
}
SocketChannel socket;
ConnectCallback callback;
}
public Cancellable connectResolvedInetSocketAddress(final InetSocketAddress address, final ConnectCallback callback) {
return connectResolvedInetSocketAddress(address, callback, null);
}
public ConnectFuture connectResolvedInetSocketAddress(final InetSocketAddress address, final ConnectCallback callback, final SocketCreateCallback createCallback) {
final ConnectFuture cancel = new ConnectFuture();
assert !address.isUnresolved();
post(new Runnable() {
@Override
public void run() {
if (cancel.isCancelled())
return;
cancel.callback = callback;
SelectionKey ckey = null;
SocketChannel socket = null;
try {
socket = cancel.socket = SocketChannel.open();
socket.configureBlocking(false);
ckey = socket.register(mSelector.getSelector(), SelectionKey.OP_CONNECT);
ckey.attach(cancel);
if (createCallback != null)
createCallback.onSocketCreated(socket.socket().getLocalPort());
socket.connect(address);
}
catch (Throwable e) {
if (ckey != null)
ckey.cancel();
StreamUtility.closeQuietly(socket);
cancel.setComplete(new RuntimeException(e));
}
}
});
return cancel;
}
public Cancellable connectSocket(final InetSocketAddress remote, final ConnectCallback callback) {
if (!remote.isUnresolved())
return connectResolvedInetSocketAddress(remote, callback);
final SimpleFuture<AsyncNetworkSocket> ret = new SimpleFuture<AsyncNetworkSocket>();
Future<InetAddress> lookup = getByName(remote.getHostName());
ret.setParent(lookup);
lookup
.setCallback(new FutureCallback<InetAddress>() {
@Override
public void onCompleted(Exception e, InetAddress result) {
if (e != null) {
callback.onConnectCompleted(e, null);
ret.setComplete(e);
return;
}
ret.setComplete((ConnectFuture)connectResolvedInetSocketAddress(new InetSocketAddress(result, remote.getPort()), callback));
}
});
return ret;
}
public Cancellable connectSocket(final String host, final int port, final ConnectCallback callback) {
return connectSocket(InetSocketAddress.createUnresolved(host, port), callback);
}
private static ExecutorService newSynchronousWorkers(String prefix) {
ThreadFactory tf = new NamedThreadFactory(prefix);
ThreadPoolExecutor tpe = new ThreadPoolExecutor(1, 4, 10L,
TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), tf);
return tpe;
}
private static final Comparator<InetAddress> ipSorter = new Comparator<InetAddress>() {
@Override
public int compare(InetAddress lhs, InetAddress rhs) {
if (lhs instanceof Inet4Address && rhs instanceof Inet4Address)
return 0;
if (lhs instanceof Inet6Address && rhs instanceof Inet6Address)
return 0;
if (lhs instanceof Inet4Address && rhs instanceof Inet6Address)
return -1;
return 1;
}
};
private static ExecutorService synchronousResolverWorkers = newSynchronousWorkers("AsyncServer-resolver-");
public Future<InetAddress[]> getAllByName(final String host) {
final SimpleFuture<InetAddress[]> ret = new SimpleFuture<InetAddress[]>();
synchronousResolverWorkers.execute(new Runnable() {
@Override
public void run() {
try {
final InetAddress[] result = InetAddress.getAllByName(host);
Arrays.sort(result, ipSorter);
if (result == null || result.length == 0)
throw new HostnameResolutionException("no addresses for host");
post(new Runnable() {
@Override
public void run() {
ret.setComplete(null, result);
}
});
} catch (final Exception e) {
post(new Runnable() {
@Override
public void run() {
ret.setComplete(e, null);
}
});
}
}
});
return ret;
}
public Future<InetAddress> getByName(String host) {
return getAllByName(host).thenConvert(addresses -> addresses[0]);
}
private void handleSocket(final AsyncNetworkSocket handler) throws ClosedChannelException {
final ChannelWrapper sc = handler.getChannel();
SelectionKey ckey = sc.register(mSelector.getSelector());
ckey.attach(handler);
handler.setup(this, ckey);
}
public AsyncDatagramSocket connectDatagram(final String host, final int port) throws IOException {
final DatagramChannel socket = DatagramChannel.open();
final AsyncDatagramSocket handler = new AsyncDatagramSocket();
handler.attach(socket);
// ugh.. this should really be post to make it nonblocking...
// but i want datagrams to be immediately writable.
// they're not really used anyways.
run(new Runnable() {
@Override
public void run() {
try {
final SocketAddress remote = new InetSocketAddress(host, port);
handleSocket(handler);
socket.connect(remote);
}
catch (IOException e) {
Log.e(LOGTAG, "Datagram error", e);
StreamUtility.closeQuietly(socket);
}
}
});
return handler;
}
public AsyncDatagramSocket openDatagram() {
return openDatagram(null, 0, false);
}
public Cancellable createDatagram(String address, int port, boolean reuseAddress, FutureCallback<AsyncDatagramSocket> callback) {
return createDatagram(() -> InetAddress.getByName(address), port, reuseAddress, callback);
}
public Cancellable createDatagram(InetAddress address, int port, boolean reuseAddress, FutureCallback<AsyncDatagramSocket> callback) {
return createDatagram(() -> address, port, reuseAddress, callback);
}
private Cancellable createDatagram(ValueFunction<InetAddress> inetAddressValueFunction, final int port, final boolean reuseAddress, FutureCallback<AsyncDatagramSocket> callback) {
SimpleFuture<AsyncDatagramSocket> ret = new SimpleFuture<>();
ret.setCallback(callback);
post(() -> {
DatagramChannel socket = null;
try {
socket = DatagramChannel.open();
final AsyncDatagramSocket handler = new AsyncDatagramSocket();
handler.attach(socket);
InetSocketAddress address;
if (inetAddressValueFunction == null)
address = new InetSocketAddress(port);
else
address = new InetSocketAddress(inetAddressValueFunction.getValue(), port);
if (reuseAddress)
socket.socket().setReuseAddress(reuseAddress);
socket.socket().bind(address);
handleSocket(handler);
if (!ret.setComplete(handler))
socket.close();
}
catch (Exception e) {
StreamUtility.closeQuietly(socket);
ret.setComplete(e);
}
});
return ret;
}
public AsyncDatagramSocket openDatagram(final InetAddress host, final int port, final boolean reuseAddress) {
final AsyncDatagramSocket handler = new AsyncDatagramSocket();
// ugh.. this should really be post to make it nonblocking...
// but i want datagrams to be immediately writable.
// they're not really used anyways.
Runnable runnable = () -> {
final DatagramChannel socket;
try {
socket = DatagramChannel.open();
}
catch (Exception e) {
return;
}
try {
handler.attach(socket);
InetSocketAddress address;
if (host == null)
address = new InetSocketAddress(port);
else
address = new InetSocketAddress(host, port);
if (reuseAddress)
socket.socket().setReuseAddress(reuseAddress);
socket.socket().bind(address);
handleSocket(handler);
}
catch (IOException e) {
Log.e(LOGTAG, "Datagram error", e);
StreamUtility.closeQuietly(socket);
}
};
if (getAffinity() != Thread.currentThread()) {
run(runnable);
return handler;
}
runnable.run();
return handler;
}
public AsyncDatagramSocket connectDatagram(final SocketAddress remote) throws IOException {
final AsyncDatagramSocket handler = new AsyncDatagramSocket();
final DatagramChannel socket = DatagramChannel.open();
handler.attach(socket);
// ugh.. this should really be post to make it nonblocking...
// but i want datagrams to be immediately writable.
// they're not really used anyways.
Runnable runnable = () -> {
try {
handleSocket(handler);
socket.connect(remote);
}
catch (IOException e) {
StreamUtility.closeQuietly(socket);
}
};
if (getAffinity() != Thread.currentThread()) {
run(runnable);
return handler;
}
runnable.run();
return handler;
}
final private static ThreadLocal<AsyncServer> threadServer = new ThreadLocal<>();
public static AsyncServer getCurrentThreadServer() {
return threadServer.get();
}
Thread mAffinity;
private void run() {
final SelectorWrapper selector;
final PriorityQueue<Scheduled> queue;
synchronized (this) {
if (mSelector == null) {
try {
selector = mSelector = new SelectorWrapper(SelectorProvider.provider().openSelector());
queue = mQueue;
}
catch (IOException e) {
throw new RuntimeException("unable to create selector?", e);
}
mAffinity = new Thread(mName) {
public void run() {
try {
threadServer.set(AsyncServer.this);
AsyncServer.run(AsyncServer.this, selector, queue);
}
finally {
threadServer.remove();
}
}
};
mAffinity.start();
// kicked off the new thread, let's bail.
return;
}
// this is a reentrant call
selector = mSelector;
queue = mQueue;
// fall through to outside of the synchronization scope
// to allow the thread to run without locking.
}
try {
runLoop(this, selector, queue);
}
catch (AsyncSelectorException e) {
Log.i(LOGTAG, "Selector closed", e);
try {
// StreamUtility.closeQuiety is throwing ArrayStoreException?
selector.getSelector().close();
}
catch (Exception ex) {
}
}
}
private static void run(final AsyncServer server, final SelectorWrapper selector, final PriorityQueue<Scheduled> queue) {
// Log.i(LOGTAG, "****AsyncServer is starting.****");
// at this point, this local queue and selector are owned
// by this thread.
// if a stop is called, the instance queue and selector
// will be replaced and nulled respectively.
// this will allow the old queue and selector to shut down
// gracefully, while also allowing a new selector thread
// to start up while the old one is still shutting down.
while(true) {
try {
runLoop(server, selector, queue);
}
catch (AsyncSelectorException e) {
if (!(e.getCause() instanceof ClosedSelectorException))
Log.i(LOGTAG, "Selector exception, shutting down", e);
StreamUtility.closeQuietly(selector);
}
// see if we keep looping, this must be in a synchronized block since the queue is accessed.
synchronized (server) {
if (selector.isOpen() && (selector.keys().size() > 0 || queue.size() > 0))
continue;
shutdownEverything(selector);
if (server.mSelector == selector) {
server.mQueue = new PriorityQueue<Scheduled>(1, Scheduler.INSTANCE);
server.mSelector = null;
server.mAffinity = null;
}
break;
}
}
// Log.i(LOGTAG, "****AsyncServer has shut down.****");
}
private static void shutdownKeys(SelectorWrapper selector) {
try {
for (SelectionKey key: selector.keys()) {
StreamUtility.closeQuietly(key.channel());
try {
key.cancel();
}
catch (Exception e) {
}
}
}
catch (Exception ex) {
}
}
private static void shutdownEverything(SelectorWrapper selector) {
shutdownKeys(selector);
// SHUT. DOWN. EVERYTHING.
StreamUtility.closeQuietly(selector);
}
private static final long QUEUE_EMPTY = Long.MAX_VALUE;
private static long lockAndRunQueue(final AsyncServer server, final PriorityQueue<Scheduled> queue) {
long wait = QUEUE_EMPTY;
// find the first item we can actually run
while (true) {
Scheduled run = null;
synchronized (server) {
long now = SystemClock.elapsedRealtime();
if (queue.size() > 0) {
Scheduled s = queue.remove();
if (s.time <= now) {
run = s;
}
else {
wait = s.time - now;
queue.add(s);
}
}
}
if (run == null)
break;
run.run();
}
server.postCounter = 0;
return wait;
}
private static class AsyncSelectorException extends IOException {
public AsyncSelectorException(Exception e) {
super(e);
}
}
private static void runLoop(final AsyncServer server, final SelectorWrapper selector, final PriorityQueue<Scheduled> queue) throws AsyncSelectorException {
// Log.i(LOGTAG, "Keys: " + selector.keys().size());
boolean needsSelect = true;
// run the queue to populate the selector with keys
long wait = lockAndRunQueue(server, queue);
try {
synchronized (server) {
// select now to see if anything is ready immediately. this
// also clears the canceled key queue.
int readyNow = selector.selectNow();
if (readyNow == 0) {
// if there is nothing to select now, make sure we don't have an empty key set
// which means it would be time to turn this thread off.
if (selector.keys().size() == 0 && wait == QUEUE_EMPTY) {
// Log.i(LOGTAG, "Shutting down. keys: " + selector.keys().size() + " keepRunning: " + keepRunning);
return;
}
}
else {
needsSelect = false;
}
}
if (needsSelect) {
if (wait == QUEUE_EMPTY) {
// wait until woken up
selector.select();
}
else {
// nothing to select immediately but there's something pending so let's block that duration and wait.
selector.select(wait);
}
}
}
catch (Exception e) {
throw new AsyncSelectorException(e);
}
// process whatever keys are ready
Set<SelectionKey> readyKeys = selector.selectedKeys();
for (SelectionKey key: readyKeys) {
try {
if (key.isAcceptable()) {
ServerSocketChannel nextReady = (ServerSocketChannel) key.channel();
SocketChannel sc = null;
SelectionKey ckey = null;
try {
sc = nextReady.accept();
if (sc == null)
continue;
sc.configureBlocking(false);
ckey = sc.register(selector.getSelector(), SelectionKey.OP_READ);
ListenCallback serverHandler = (ListenCallback) key.attachment();
AsyncNetworkSocket handler = new AsyncNetworkSocket();
handler.attach(sc, (InetSocketAddress)sc.socket().getRemoteSocketAddress());
handler.setup(server, ckey);
ckey.attach(handler);
serverHandler.onAccepted(handler);
}
catch (IOException e) {
StreamUtility.closeQuietly(sc);
if (ckey != null)
ckey.cancel();
}
}
else if (key.isReadable()) {
AsyncNetworkSocket handler = (AsyncNetworkSocket) key.attachment();
int transmitted = handler.onReadable();
server.onDataReceived(transmitted);
}
else if (key.isWritable()) {
AsyncNetworkSocket handler = (AsyncNetworkSocket) key.attachment();
handler.onDataWritable();
}
else if (key.isConnectable()) {
ConnectFuture cancel = (ConnectFuture) key.attachment();
SocketChannel sc = (SocketChannel) key.channel();
key.interestOps(SelectionKey.OP_READ);
AsyncNetworkSocket newHandler;
try {
sc.finishConnect();
newHandler = new AsyncNetworkSocket();
newHandler.setup(server, key);
newHandler.attach(sc, (InetSocketAddress)sc.socket().getRemoteSocketAddress());
key.attach(newHandler);
}
catch (IOException ex) {
key.cancel();
StreamUtility.closeQuietly(sc);
if (cancel.setComplete(ex))
cancel.callback.onConnectCompleted(ex, null);
continue;
}
if (cancel.setComplete(newHandler))
cancel.callback.onConnectCompleted(null, newHandler);
}
else {
Log.i(LOGTAG, "wtf");
throw new RuntimeException("Unknown key state.");
}
}
catch (CancelledKeyException ex) {
}
}
readyKeys.clear();
}
public void dump() {
post(new Runnable() {
@Override
public void run() {
if (mSelector == null) {
Log.i(LOGTAG, "Server dump not possible. No selector?");
return;
}
Log.i(LOGTAG, "Key Count: " + mSelector.keys().size());
for (SelectionKey key: mSelector.keys()) {
Log.i(LOGTAG, "Key: " + key);
}
}
});
}
public Thread getAffinity() {
return mAffinity;
}
public boolean isAffinityThread() {
return mAffinity == Thread.currentThread();
}
public boolean isAffinityThreadOrStopped() {
Thread affinity = mAffinity;
return affinity == null || affinity == Thread.currentThread();
}
private static class NamedThreadFactory implements ThreadFactory {
private final ThreadGroup group;
private final AtomicInteger threadNumber = new AtomicInteger(1);
private final String namePrefix;
NamedThreadFactory(String namePrefix) {
SecurityManager s = System.getSecurityManager();
group = (s != null) ? s.getThreadGroup() :
Thread.currentThread().getThreadGroup();
this.namePrefix = namePrefix;
}
public Thread newThread(Runnable r) {
Thread t = new Thread(group, r,
namePrefix + threadNumber.getAndIncrement(), 0);
if (t.isDaemon()) t.setDaemon(false);
if (t.getPriority() != Thread.NORM_PRIORITY) {
t.setPriority(Thread.NORM_PRIORITY);
}
return t;
}
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncServerSocket.java
================================================
package com.jeffmony.async;
public interface AsyncServerSocket {
void stop();
int getLocalPort();
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncSocket.java
================================================
package com.jeffmony.async;
public interface AsyncSocket extends DataEmitter, DataSink {
AsyncServer getServer();
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/BufferedDataSink.java
================================================
package com.jeffmony.async;
import com.jeffmony.async.callback.CompletedCallback;
import com.jeffmony.async.callback.WritableCallback;
public class BufferedDataSink implements DataSink {
DataSink mDataSink;
public BufferedDataSink(DataSink datasink) {
setDataSink(datasink);
}
public boolean isBuffering() {
return mPendingWrites.hasRemaining() || forceBuffering;
}
public boolean isWritable() {
synchronized (mPendingWrites) {
return mPendingWrites.remaining() < mMaxBuffer;
}
}
public DataSink getDataSink() {
return mDataSink;
}
boolean forceBuffering;
public void forceBuffering(boolean forceBuffering) {
this.forceBuffering = forceBuffering;
if (!forceBuffering)
writePending();
}
public void setDataSink(DataSink datasink) {
mDataSink = datasink;
mDataSink.setWriteableCallback(this::writePending);
}
private void writePending() {
if (forceBuffering)
return;
// Log.i("NIO", "Writing to buffer...");
boolean empty;
synchronized (mPendingWrites) {
mDataSink.write(mPendingWrites);
empty = mPendingWrites.isEmpty();
}
if (empty) {
if (endPending)
mDataSink.end();
}
if (empty && mWritable != null)
mWritable.onWriteable();
}
final ByteBufferList mPendingWrites = new ByteBufferList();
// before the data is queued, let inheritors know. allows for filters, without
// issues with having to filter before writing which may fail in the buffer.
protected void onDataAccepted(ByteBufferList bb) {
}
@Override
public void write(final ByteBufferList bb) {
if (getServer().getAffinity() != Thread.currentThread()) {
synchronized (mPendingWrites) {
if (mPendingWrites.remaining() >= mMaxBuffer)
return;
onDataAccepted(bb);
bb.get(mPendingWrites);
}
getServer().post(this::writePending);
return;
}
onDataAccepted(bb);
if (!isBuffering())
mDataSink.write(bb);
synchronized (mPendingWrites) {
bb.get(mPendingWrites);
}
}
WritableCallback mWritable;
@Override
public void setWriteableCallback(WritableCallback handler) {
mWritable = handler;
}
@Override
public WritableCallback getWriteableCallback() {
return mWritable;
}
public int remaining() {
return mPendingWrites.remaining();
}
int mMaxBuffer = Integer.MAX_VALUE;
public int getMaxBuffer() {
return mMaxBuffer;
}
public void setMaxBuffer(int maxBuffer) {
assert maxBuffer >= 0;
mMaxBuffer = maxBuffer;
}
@Override
public boolean isOpen() {
return mDataSink.isOpen();
}
boolean endPending;
@Override
public void end() {
if (getServer().getAffinity() != Thread.currentThread()) {
getServer().post(this::end);
return;
}
synchronized (mPendingWrites) {
if (mPendingWrites.hasRemaining()) {
endPending = true;
return;
}
}
mDataSink.end();
}
@Override
public void setClosedCallback(CompletedCallback handler) {
mDataSink.setClosedCallback(handler);
}
@Override
public CompletedCallback getClosedCallback() {
return mDataSink.getClosedCallback();
}
@Override
public AsyncServer getServer() {
return mDataSink.getServer();
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/ByteBufferList.java
================================================
package com.jeffmony.async;
import android.annotation.TargetApi;
import android.os.Build;
import android.os.Looper;
import com.jeffmony.async.util.ArrayDeque;
import com.jeffmony.async.util.Charsets;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.Charset;
import java.util.Comparator;
import java.util.PriorityQueue;
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public class ByteBufferList {
ArrayDeque<ByteBuffer> mBuffers = new ArrayDeque<ByteBuffer>();
ByteOrder order = ByteOrder.BIG_ENDIAN;
public ByteOrder order() {
return order;
}
public ByteBufferList order(ByteOrder order) {
this.order = order;
return this;
}
public ByteBufferList() {
}
public ByteBufferList(ByteBuffer... b) {
addAll(b);
}
public ByteBufferList(byte[] buf) {
super();
ByteBuffer b = ByteBuffer.wrap(buf);
add(b);
}
public ByteBufferList addAll(ByteBuffer... bb) {
for (ByteBuffer b: bb)
add(b);
return this;
}
public ByteBufferList addAll(ByteBufferList... bb) {
for (ByteBufferList b: bb)
b.get(this);
return this;
}
public byte[] getBytes(int length) {
byte[] ret = new byte[length];
get(ret);
return ret;
}
public byte[] getAllByteArray() {
byte[] ret = new byte[remaining()];
get(ret);
return ret;
}
public ByteBuffer[] getAllArray() {
ByteBuffer[] ret = new ByteBuffer[mBuffers.size()];
ret = mBuffers.toArray(ret);
mBuffers.clear();
remaining = 0;
return ret;
}
public boolean isEmpty() {
return remaining == 0;
}
private int remaining = 0;
public int remaining() {
return remaining;
}
public boolean hasRemaining() {
return remaining() > 0;
}
public short peekShort() {
return read(2).getShort(mBuffers.peekFirst().position());
}
public byte peek() {
return read(1).get(mBuffers.peekFirst().position());
}
public int peekInt() {
return read(4).getInt(mBuffers.peekFirst().position());
}
public long peekLong() {
return read(8).getLong(mBuffers.peekFirst().position());
}
public byte[] peekBytes(int size) {
byte[] ret = new byte[size];
read(size).get(ret, mBuffers.peekFirst().position(), ret.length);
return ret;
}
public ByteBufferList skip(int length) {
get(null, 0, length);
return this;
}
public int getInt() {
int ret = read(4).getInt();
remaining -= 4;
return ret;
}
public char getByteChar() {
char ret = (char)read(1).get();
remaining--;
return ret;
}
public short getShort() {
short ret = read(2).getShort();
remaining -= 2;
return ret;
}
public byte get() {
byte ret = read(1).get();
remaining--;
return ret;
}
public long getLong() {
long ret = read(8).getLong();
remaining -= 8;
return ret;
}
public void get(byte[] bytes) {
get(bytes, 0, bytes.length);
}
public void get(byte[] bytes, int offset, int length) {
if (remaining() < length)
throw new IllegalArgumentException("length");
int need = length;
while (need > 0) {
ByteBuffer b = mBuffers.peek();
int read = Math.min(b.remaining(), need);
if (bytes != null){
b.get(bytes, offset, read);
} else {
//when bytes is null, just skip data.
b.position(b.position() + read);
}
need -= read;
offset += read;
if (b.remaining() == 0) {
ByteBuffer removed = mBuffers.remove();
assert b == removed;
reclaim(b);
}
}
remaining -= length;
}
public void get(ByteBufferList into, int length) {
if (remaining() < length)
throw new IllegalArgumentException("length");
int offset = 0;
while (offset < length) {
ByteBuffer b = mBuffers.remove();
int remaining = b.remaining();
if (remaining == 0) {
reclaim(b);
continue;
}
if (offset + remaining > length) {
int need = length - offset;
// this is shared between both
ByteBuffer subset = obtain(need);
subset.limit(need);
b.get(subset.array(), 0, need);
into.add(subset);
mBuffers.addFirst(b);
assert subset.capacity() >= need;
assert subset.position() == 0;
break;
}
else {
// this belongs to the new list
into.add(b);
}
offset += remaining;
}
remaining -= length;
}
public void get(ByteBufferList into) {
get(into, remaining());
}
public ByteBufferList get(int length) {
ByteBufferList ret = new ByteBufferList();
get(ret, length);
return ret.order(order);
}
public ByteBuffer getAll() {
if (remaining() == 0)
return EMPTY_BYTEBUFFER;
read(remaining());
return remove();
}
private ByteBuffer read(int count) {
if (remaining() < count)
throw new IllegalArgumentException("count : " + remaining() + "/" + count);
ByteBuffer first = mBuffers.peek();
while (first != null && !first.hasRemaining()) {
reclaim(mBuffers.remove());
first = mBuffers.peek();
}
if (first == null) {
return EMPTY_BYTEBUFFER;
}
if (first.remaining() >= count) {
return first.order(order);
}
ByteBuffer ret = obtain(count);
ret.limit(count);
byte[] bytes = ret.array();
int offset = 0;
ByteBuffer bb = null;
while (offset < count) {
bb = mBuffers.remove();
int toRead = Math.min(count - offset, bb.remaining());
bb.get(bytes, offset, toRead);
offset += toRead;
if (bb.remaining() == 0) {
reclaim(bb);
bb = null;
}
}
// if there was still data left in the last buffer we popped
// toss it back into the head
if (bb != null && bb.remaining() > 0)
mBuffers.addFirst(bb);
mBuffers.addFirst(ret);
return ret.order(order);
}
public void trim() {
// this clears out buffers that are empty in the beginning of the list
read(0);
}
public ByteBufferList add(ByteBufferList b) {
b.get(this);
return this;
}
public ByteBufferList add(ByteBuffer b) {
if (b.remaining() <= 0) {
// System.out.println("reclaiming remaining: " + b.remaining());
reclaim(b);
return this;
}
addRemaining(b.remaining());
// see if we can fit the entirety of the buffer into the end
// of the current last buffer
if (mBuffers.size() > 0) {
ByteBuffer last = mBuffers.getLast();
if (last.capacity() - last.limit() >= b.remaining()) {
last.mark();
last.position(last.limit());
last.limit(last.capacity());
last.put(b);
last.limit(last.position());
last.reset();
reclaim(b);
trim();
return this;
}
}
mBuffers.add(b);
trim();
return this;
}
public void addFirst(ByteBuffer b) {
if (b.remaining() <= 0) {
reclaim(b);
return;
}
addRemaining(b.remaining());
// see if we can fit the entirety of the buffer into the beginning
// of the current first buffer
if (mBuffers.size() > 0) {
ByteBuffer first = mBuffers.getFirst();
if (first.position() >= b.remaining()) {
first.position(first.position() - b.remaining());
first.mark();
first.put(b);
first.reset();
reclaim(b);
return;
}
}
mBuffers.addFirst(b);
}
private void addRemaining(int remaining) {
if (this.remaining() >= 0)
this.remaining += remaining;
}
public void recycle() {
while (mBuffers.size() > 0) {
reclaim(mBuffers.remove());
}
assert mBuffers.size() == 0;
remaining = 0;
}
public ByteBuffer remove() {
ByteBuffer ret = mBuffers.remove();
remaining -= ret.remaining();
return ret;
}
public int size() {
return mBuffers.size();
}
public void spewString() {
System.out.println(peekString());
}
public String peekString() {
return peekString(null);
}
// not doing toString as this is really nasty in the debugger...
public String peekString(Charset charset) {
if (charset == null)
charset = Charsets.UTF_8;
StringBuilder builder = new StringBuilder();
for (ByteBuffer bb: mBuffers) {
byte[] bytes;
int offset;
int length;
if (bb.isDirect()) {
bytes = new byte[bb.remaining()];
offset = 0;
length = bb.remaining();
bb.get(bytes);
}
else {
bytes = bb.array();
offset = bb.arrayOffset() + bb.position();
length = bb.remaining();
}
builder.append(new String(bytes, offset, length, charset));
}
return builder.toString();
}
public String readString() {
return readString(null);
}
public String readString(Charset charset) {
String ret = peekString(charset);
recycle();
return ret;
}
static class Reclaimer implements Comparator<ByteBuffer> {
@Override
public int compare(ByteBuffer byteBuffer, ByteBuffer byteBuffer2) {
// keep the smaller ones at the head, so they get tossed out quicker
if (byteBuffer.capacity() == byteBuffer2.capacity())
return 0;
if (byteBuffer.capacity() > byteBuffer2.capacity())
return 1;
return -1;
}
}
static PriorityQueue<ByteBuffer> reclaimed = new PriorityQueue<ByteBuffer>(8, new Reclaimer());
private static PriorityQueue<ByteBuffer> getReclaimed() {
Looper mainLooper = Looper.getMainLooper();
if (mainLooper != null) {
if (Thread.currentThread() == mainLooper.getThread())
return null;
}
return reclaimed;
}
private static int MAX_SIZE = 1024 * 1024;
public static int MAX_ITEM_SIZE = 1024 * 256;
static int currentSize = 0;
static int maxItem = 0;
public static void setMaxPoolSize(int size) {
MAX_SIZE = size;
}
public static void setMaxItemSize(int size) {
MAX_ITEM_SIZE = size;
}
private static boolean reclaimedContains(ByteBuffer b) {
for (ByteBuffer other: reclaimed) {
if (other == b)
return true;
}
return false;
}
public static void reclaim(ByteBuffer b) {
if (b == null || b.isDirect())
return;
if (b.arrayOffset() != 0 || b.array().length != b.capacity())
return;
if (b.capacity() < 8192)
return;
if (b.capacity() > MAX_ITEM_SIZE)
return;
PriorityQueue<ByteBuffer> r = getReclaimed();
if (r == null)
return;
synchronized (LOCK) {
while (currentSize > MAX_SIZE && r.size() > 0 && r.peek().capacity() < b.capacity()) {
// System.out.println("removing for better: " + b.capacity());
ByteBuffer head = r.remove();
currentSize -= head.capacity();
}
if (currentSize > MAX_SIZE) {
// System.out.println("too full: " + b.capacity());
return;
}
assert !reclaimedContains(b);
b.position(0);
b.limit(b.capacity());
currentSize += b.capacity();
r.add(b);
assert r.size() != 0 ^ currentSize == 0;
maxItem = Math.max(maxItem, b.capacity());
}
}
private static final Object LOCK = new Object();
public static ByteBuffer obtain(int size) {
if (size <= maxItem) {
PriorityQueue<ByteBuffer> r = getReclaimed();
if (r != null) {
synchronized (LOCK) {
while (r.size() > 0) {
ByteBuffer ret = r.remove();
if (r.size() == 0)
maxItem = 0;
currentSize -= ret.capacity();
assert r.size() != 0 ^ currentSize == 0;
if (ret.capacity() >= size) {
// System.out.println("using " + ret.capacity());
return ret;
}
// System.out.println("dumping " + ret.capacity());
}
}
}
}
// System.out.println("alloc for " + size);
ByteBuffer ret = ByteBuffer.allocate(Math.max(8192, size));
return ret;
}
public static void obtainArray(ByteBuffer[] arr, int size) {
PriorityQueue<ByteBuffer> r = getReclaimed();
int index = 0;
int total = 0;
if (r != null) {
synchronized (LOCK) {
while (r.size() > 0 && total < size && index < arr.length - 1) {
ByteBuffer b = r.remove();
currentSize -= b.capacity();
assert r.size() != 0 ^ currentSize == 0;
int needed = Math.min(size - total, b.capacity());
total += needed;
arr[index++] = b;
}
}
}
if (total < size) {
ByteBuffer b = ByteBuffer.allocate(Math.max(8192, size - total));
arr[index++] = b;
}
for (int i = index; i < arr.length; i++) {
arr[i] = EMPTY_BYTEBUFFER;
}
}
public static ByteBuffer deepCopy(ByteBuffer copyOf) {
if (copyOf == null)
return null;
return (ByteBuffer)obtain(copyOf.remaining()).put(copyOf.duplicate()).flip();
}
public static final ByteBuffer EMPTY_BYTEBUFFER = ByteBuffer.allocate(0);
public static void writeOutputStream(OutputStream out, ByteBuffer b) throws IOException {
byte[] bytes;
int offset;
int length;
if (b.isDirect()) {
bytes = new byte[b.remaining()];
offset = 0;
length = b.remaining();
b.get(bytes);
}
else {
bytes = b.array();
offset = b.arrayOffset() + b.position();
length = b.remaining();
}
out.write(bytes, offset, length);
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/ChannelWrapper.java
================================================
package com.jeffmony.async;
import java.io.IOException;
import java.net.InetAddress;
import java.nio.ByteBuffer;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.ScatteringByteChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.spi.AbstractSelectableChannel;
abstract class ChannelWrapper implements ReadableByteChannel, ScatteringByteChannel {
private AbstractSelectableChannel mChannel;
ChannelWrapper(AbstractSelectableChannel channel) throws IOException {
channel.configureBlocking(false);
mChannel = channel;
}
public abstract void shutdownInput();
public abstract void shutdownOutput();
public abstract boolean isConnected();
public abstract int write(ByteBuffer src) throws IOException;
public abstract int write(ByteBuffer[] src) throws IOException;
// register for default events appropriate for this channel
public abstract SelectionKey register(Selector sel) throws ClosedChannelException;
public SelectionKey register(Selector sel, int ops) throws ClosedChannelException {
return mChannel.register(sel, ops);
}
public boolean isChunked() {
return false;
}
@Override
public boolean isOpen() {
return mChannel.isOpen();
}
@Override
public void close() throws IOException {
mChannel.close();
}
public abstract int getLocalPort();
public abstract InetAddress getLocalAddress();
public abstract Object getSocket();
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/DataEmitter.java
================================================
package com.jeffmony.async;
import com.jeffmony.async.callback.CompletedCallback;
import com.jeffmony.async.callback.DataCallback;
public interface DataEmitter {
void setDataCallback(DataCallback callback);
DataCallback getDataCallback();
boolean isChunked();
void pause();
void resume();
void close();
boolean isPaused();
void setEndCallback(CompletedCallback callback);
CompletedCallback getEndCallback();
AsyncServer getServer();
String charset();
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/DataEmitterBase.java
================================================
package com.jeffmony.async;
import com.jeffmony.async.callback.CompletedCallback;
import com.jeffmony.async.callback.DataCallback;
/**
* Created by koush on 5/27/13.
*/
public abstract class DataEmitterBase implements DataEmitter {
private boolean ended;
protected void report(Exception e) {
if (ended)
return;
ended = true;
if (getEndCallback() != null)
getEndCallback().onCompleted(e);
}
@Override
public final void setEndCallback(CompletedCallback callback) {
endCallback = callback;
}
CompletedCallback endCallback;
@Override
public final CompletedCallback getEndCallback() {
return endCallback;
}
DataCallback mDataCallback;
@Override
public void setDataCallback(DataCallback callback) {
mDataCallback = callback;
}
@Override
public DataCallback getDataCallback() {
return mDataCallback;
}
@Override
public String charset() {
return null;
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/DataEmitterReader.java
================================================
package com.jeffmony.async;
import com.jeffmony.async.callback.DataCallback;
public class DataEmitterReader implements DataCallback {
DataCallback mPendingRead;
int mPendingReadLength;
ByteBufferList mPendingData = new ByteBufferList();
public void read(int count, DataCallback callback) {
assert mPendingRead == null;
mPendingReadLength = count;
mPendingRead = callback;
assert !mPendingData.hasRemaining();
mPendingData.recycle();
}
private boolean handlePendingData(DataEmitter emitter) {
if (mPendingReadLength > mPendingData.remaining())
return false;
DataCallback pendingRead = mPendingRead;
mPendingRead = null;
pendingRead.onDataAvailable(emitter, mPendingData);
assert !mPendingData.hasRemaining();
return true;
}
public DataEmitterReader() {
}
@Override
public void onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
// if we're registered for data, we must be waiting for a read
assert mPendingRead != null;
do {
int need = Math.min(bb.remaining(), mPendingReadLength - mPendingData.remaining());
bb.get(mPendingData, need);
bb.remaining();
}
while (handlePendingData(emitter) && mPendingRead != null);
bb.remaining();
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/DataSink.java
================================================
package com.jeffmony.async;
import com.jeffmony.async.callback.CompletedCallback;
import com.jeffmony.async.callback.WritableCallback;
public interface DataSink {
public void write(ByteBufferList bb);
public void setWriteableCallback(WritableCallback handler);
public WritableCallback getWriteableCallback();
public boolean isOpen();
public void end();
public void setClosedCallback(CompletedCallback handler);
public CompletedCallback getClosedCallback();
public AsyncServer getServer();
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/DataTrackingEmitter.java
================================================
package com.jeffmony.async;
/**
* Created by koush on 5/28/13.
*/
public interface DataTrackingEmitter extends DataEmitter {
interface DataTracker {
void onData(int totalBytesRead);
}
void setDataTracker(DataTracker tracker);
DataTracker getDataTracker();
int getBytesRead();
void setDataEmitter(DataEmitter emitter);
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/DatagramChannelWrapper.java
================================================
package com.jeffmony.async;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.DatagramChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
class DatagramChannelWrapper extends ChannelWrapper {
DatagramChannel mChannel;
@Override
public InetAddress getLocalAddress() {
return mChannel.socket().getLocalAddress();
}
@Override
public int getLocalPort() {
return mChannel.socket().getLocalPort();
}
InetSocketAddress address;
public InetSocketAddress getRemoteAddress() {
return address;
}
public void disconnect() throws IOException {
mChannel.disconnect();
}
DatagramChannelWrapper(DatagramChannel channel) throws IOException {
super(channel);
mChannel = channel;
}
@Override
public int read(ByteBuffer buffer) throws IOException {
if (!isConnected()) {
int position = buffer.position();
address = (InetSocketAddress)mChannel.receive(buffer);
if (address == null)
return -1;
return buffer.position() - position;
}
address = null;
return mChannel.read(buffer);
}
@Override
public boolean isConnected() {
return mChannel.isConnected();
}
@Override
public int write(ByteBuffer src) throws IOException {
return mChannel.write(src);
}
@Override
public int write(ByteBuffer[] src) throws IOException {
return (int)mChannel.write(src);
}
@Override
public SelectionKey register(Selector sel, int ops) throws ClosedChannelException {
return mChannel.register(sel, ops);
}
@Override
public boolean isChunked() {
return true;
}
@Override
public SelectionKey register(Selector sel) throws ClosedChannelException {
return register(sel, SelectionKey.OP_READ);
}
@Override
public void shutdownOutput() {
}
@Override
public void shutdownInput() {
}
@Override
public long read(ByteBuffer[] byteBuffers) throws IOException {
return mChannel.read(byteBuffers);
}
@Override
public long read(ByteBuffer[] byteBuffers, int i, int i2) throws IOException {
return mChannel.read(byteBuffers, i, i2);
}
@Override
public Object getSocket() {
return mChannel.socket();
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/FileDataEmitter.java
================================================
package com.jeffmony.async;
import com.jeffmony.async.callback.DataCallback;
import com.jeffmony.async.util.StreamUtility;
import java.io.File;
import java.io.FileInputStream;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
/**
* Created by koush on 5/22/13.
*/
public class FileDataEmitter extends DataEmitterBase {
AsyncServer server;
File file;
public FileDataEmitter(AsyncServer server, File file) {
this.server = server;
this.file = file;
paused = !server.isAffinityThread();
if (!paused)
doResume();
}
DataCallback callback;
@Override
public void setDataCallback(DataCallback callback) {
this.callback = callback;
}
@Override
public DataCallback getDataCallback() {
return callback;
}
@Override
public boolean isChunked() {
return false;
}
boolean paused;
@Override
public void pause() {
paused = true;
}
@Override
public void resume() {
paused = false;
doResume();
}
@Override
protected void report(Exception e) {
StreamUtility.closeQuietly(channel);
super.report(e);
}
ByteBufferList pending = new ByteBufferList();
FileChannel channel;
Runnable pumper = new Runnable() {
@Override
public void run() {
try {
if (channel == null)
channel = new FileInputStream(file).getChannel();
if (!pending.isEmpty()) {
Util.emitAllData(FileDataEmitter.this, pending);
if (!pending.isEmpty())
return;
}
ByteBuffer b;
do {
b = ByteBufferList.obtain(8192);
if (-1 == channel.read(b)) {
report(null);
return;
}
b.flip();
pending.add(b);
Util.emitAllData(FileDataEmitter.this, pending);
}
while (pending.remaining() == 0 && !isPaused());
}
catch (Exception e) {
report(e);
}
}
};
private void doResume() {
server.post(pumper);
}
@Override
public boolean isPaused() {
return paused;
}
@Override
public AsyncServer getServer() {
return server;
}
@Override
public void close() {
try {
channel.close();
}
catch (Exception e) {
}
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/FilteredDataEmitter.java
================================================
package com.jeffmony.async;
import com.jeffmony.async.callback.CompletedCallback;
import com.jeffmony.async.callback.DataCallback;
import com.jeffmony.async.wrapper.DataEmitterWrapper;
public class FilteredDataEmitter extends DataEmitterBase implements DataEmitter, DataCallback, DataEmitterWrapper, DataTrackingEmitter {
private DataEmitter mEmitter;
@Override
public DataEmitter getDataEmitter() {
return mEmitter;
}
@Override
public void setDataEmitter(DataEmitter emitter) {
if (mEmitter != null) {
mEmitter.setDataCallback(null);
}
mEmitter = emitter;
mEmitter.setDataCallback(this);
mEmitter.setEndCallback(new CompletedCallback() {
@Override
public void onCompleted(Exception ex) {
report(ex);
}
});
}
@Override
public int getBytesRead() {
return totalRead;
}
@Override
public DataTracker getDataTracker() {
return tracker;
}
@Override
public void setDataTracker(DataTracker tracker) {
this.tracker = tracker;
}
private DataTracker tracker;
private int totalRead;
@Override
public void onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
if (closed) {
// this emitter was closed but for some reason data is still being spewed...
// eat it, nom nom.
bb.recycle();
return;
}
if (bb != null)
totalRead += bb.remaining();
Util.emitAllData(this, bb);
if (bb != null)
totalRead -= bb.remaining();
if (tracker != null && bb != null)
tracker.onData(totalRead);
// if there's data after the emitting, and it is paused... the underlying implementation
// is obligated to cache the byte buffer list.
}
@Override
public boolean isChunked() {
return mEmitter.isChunked();
}
@Override
public void pause() {
mEmitter.pause();
}
@Override
public void resume() {
mEmitter.resume();
}
@Override
public boolean isPaused() {
return mEmitter.isPaused();
}
@Override
public AsyncServer getServer() {
return mEmitter.getServer();
}
boolean closed;
@Override
public void close() {
closed = true;
if (mEmitter != null)
mEmitter.close();
}
@Override
public String charset() {
if (mEmitter == null)
return null;
return mEmitter.charset();
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/FilteredDataSink.java
================================================
package com.jeffmony.async;
public class FilteredDataSink extends BufferedDataSink {
public FilteredDataSink(DataSink sink) {
super(sink);
setMaxBuffer(0);
}
public ByteBufferList filter(ByteBufferList bb) {
return bb;
}
@Override
protected void onDataAccepted(ByteBufferList bb) {
ByteBufferList filtered = filter(bb);
// filtering may return the same byte buffer, so watch for that.
if (filtered != bb) {
bb.recycle();
filtered.get(bb);
}
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/HostnameResolutionException.java
================================================
package com.jeffmony.async;
public class HostnameResolutionException extends Exception {
public HostnameResolutionException(String message) {
super(message);
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/LineEmitter.java
================================================
package com.jeffmony.async;
import com.jeffmony.async.callback.DataCallback;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
public class LineEmitter implements DataCallback {
public interface StringCallback {
void onStringAvailable(String s);
}
public LineEmitter() {
this(null);
}
public LineEmitter(Charset charset) {
this.charset = charset;
}
Charset charset;
ByteBufferList data = new ByteBufferList();
StringCallback mLineCallback;
public void setLineCallback(StringCallback callback) {
mLineCallback = callback;
}
public StringCallback getLineCallback() {
return mLineCallback;
}
@Override
public void onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
ByteBuffer buffer = ByteBuffer.allocate(bb.remaining());
while (bb.remaining() > 0) {
byte b = bb.get();
if (b == '\n') {
assert mLineCallback != null;
buffer.flip();
data.add(buffer);
mLineCallback.onStringAvailable(data.readString(charset));
data = new ByteBufferList();
return;
}
else {
buffer.put(b);
}
}
buffer.flip();
data.add(buffer);
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/PushParser.java
================================================
package com.jeffmony.async;
import android.util.Log;
import com.jeffmony.async.callback.DataCallback;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.LinkedList;
public class PushParser implements DataCallback {
public interface ParseCallback<T> {
public void parsed(T data);
}
static abstract class Waiter {
int length;
public Waiter(int length) {
this.length = length;
}
/**
* Consumes received data, and/or returns next waiter to continue reading instead of this waiter.
* @param bb received data, bb.remaining >= length
* @return - a waiter that should continue reading right away, or null if this waiter is finished
*/
public abstract Waiter onDataAvailable(DataEmitter emitter, ByteBufferList bb);
}
static class IntWaiter extends Waiter {
ParseCallback<Integer> callback;
public IntWaiter(ParseCallback<Integer> callback) {
super(4);
this.callback = callback;
}
@Override
public Waiter onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
callback.parsed(bb.getInt());
return null;
}
}
static class ByteArrayWaiter extends Waiter {
ParseCallback<byte[]> callback;
public ByteArrayWaiter(int length, ParseCallback<byte[]> callback) {
super(length);
if (length <= 0)
throw new IllegalArgumentException("length should be > 0");
this.callback = callback;
}
@Override
public Waiter onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
byte[] bytes = new byte[length];
bb.get(bytes);
callback.parsed(bytes);
return null;
}
}
static class LenByteArrayWaiter extends Waiter {
private final ParseCallback<byte[]> callback;
public LenByteArrayWaiter(ParseCallback<byte[]> callback) {
super(4);
this.callback = callback;
}
@Override
public Waiter onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
int length = bb.getInt();
if (length == 0) {
callback.parsed(new byte[0]);
return null;
}
return new ByteArrayWaiter(length, callback);
}
}
static class ByteBufferListWaiter extends Waiter {
ParseCallback<ByteBufferList> callback;
public ByteBufferListWaiter(int length, ParseCallback<ByteBufferList> callback) {
super(length);
if (length <= 0) throw new IllegalArgumentException("length should be > 0");
this.callback = callback;
}
@Override
public Waiter onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
callback.parsed(bb.get(length));
return null;
}
}
static class LenByteBufferListWaiter extends Waiter {
private final ParseCallback<ByteBufferList> callback;
public LenByteBufferListWaiter(ParseCallback<ByteBufferList> callback) {
super(4);
this.callback = callback;
}
@Override
public Waiter onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
int length = bb.getInt();
return new ByteBufferListWaiter(length, callback);
}
}
static class UntilWaiter extends Waiter {
byte value;
DataCallback callback;
public UntilWaiter(byte value, DataCallback callback) {
super(1);
this.value = value;
this.callback = callback;
}
@Override
public Waiter onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
boolean found = true;
ByteBufferList cb = new ByteBufferList();
while (bb.size() > 0) {
ByteBuffer b = bb.remove();
b.mark();
int index = 0;
while (b.remaining() > 0 && !(found = (b.get() == value))) {
index++;
}
b.reset();
if (found) {
bb.addFirst(b);
bb.get(cb, index);
// eat the one we're waiting on
bb.get();
break;
} else {
cb.add(b);
}
}
callback.onDataAvailable(emitter, cb);
if (found) {
return null;
} else {
return this;
}
}
}
private class TapWaiter extends Waiter {
private final TapCallback callback;
public TapWaiter(TapCallback callback) {
super(0);
this.callback = callback;
}
@Override
public Waiter onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
Method method = getTap(callback);
method.setAccessible(true);
try {
method.invoke(callback, args.toArray());
} catch (Exception e) {
Log.e("PushParser", "Error while invoking tap callback", e);
}
args.clear();
return null;
}
}
private Waiter noopArgWaiter = new Waiter(0) {
@Override
public Waiter onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
args.add(null);
return null;
}
};
private Waiter byteArgWaiter = new Waiter(1) {
@Override
public Waiter onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
args.add(bb.get());
return null;
}
};
private Waiter shortArgWaiter = new Waiter(2) {
@Override
public Waiter onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
args.add(bb.getShort());
return null;
}
};
private Waiter intArgWaiter = new Waiter(4) {
@Override
public Waiter onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
args.add(bb.getInt());
return null;
}
};
private Waiter longArgWaiter = new Waiter(8) {
@Override
public Waiter onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
args.add(bb.getLong());
return null;
}
};
private ParseCallback<byte[]> byteArrayArgCallback = new ParseCallback<byte[]>() {
@Override
public void parsed(byte[] data) {
args.add(data);
}
};
private ParseCallback<ByteBufferList> byteBufferListArgCallback = new ParseCallback<ByteBufferList>() {
@Override
public void parsed(ByteBufferList data) {
args.add(data);
}
};
private ParseCallback<byte[]> stringArgCallback = new ParseCallback<byte[]>() {
@Override
public void parsed(byte[] data) {
args.add(new String(data));
}
};
DataEmitter mEmitter;
private LinkedList<Waiter> mWaiting = new LinkedList<Waiter>();
private ArrayList<Object> args = new ArrayList<Object>();
ByteOrder order = ByteOrder.BIG_ENDIAN;
public PushParser setOrder(ByteOrder order) {
this.order = order;
return this;
}
public PushParser(DataEmitter s) {
mEmitter = s;
mEmitter.setDataCallback(this);
}
public PushParser readInt(ParseCallback<Integer> callback) {
mWaiting.add(new IntWaiter(callback));
return this;
}
public PushParser readByteArray(int length, ParseCallback<byte[]> callback) {
mWaiting.add(new ByteArrayWaiter(length, callback));
return this;
}
public PushParser readByteBufferList(int length, ParseCallback<ByteBufferList> callback) {
mWaiting.add(new ByteBufferListWaiter(length, callback));
return this;
}
public PushParser until(byte b, DataCallback callback) {
mWaiting.add(new UntilWaiter(b, callback));
return this;
}
public PushParser readByte() {
mWaiting.add(byteArgWaiter);
return this;
}
public PushParser readShort() {
mWaiting.add(shortArgWaiter);
return this;
}
public PushParser readInt() {
mWaiting.add(intArgWaiter);
return this;
}
public PushParser readLong() {
mWaiting.add(longArgWaiter);
return this;
}
public PushParser readByteArray(int length) {
return (length == -1) ? readLenByteArray() : readByteArray(length, byteArrayArgCallback);
}
public PushParser readLenByteArray() {
mWaiting.add(new LenByteArrayWaiter(byteArrayArgCallback));
return this;
}
public PushParser readByteBufferList(int length) {
return (length == -1) ? readLenByteBufferList() : readByteBufferList(length, byteBufferListArgCallback);
}
public PushParser readLenByteBufferList() {
return readLenByteBufferList(byteBufferListArgCallback);
}
public PushParser readLenByteBufferList(ParseCallback<ByteBufferList> callback) {
mWaiting.add(new LenByteBufferListWaiter(callback));
return this;
}
public PushParser readString() {
mWaiting.add(new LenByteArrayWaiter(stringArgCallback));
return this;
}
public PushParser noop() {
mWaiting.add(noopArgWaiter);
return this;
}
ByteBufferList pending = new ByteBufferList();
@Override
public void onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
bb.get(pending);
while (mWaiting.size() > 0 && pending.remaining() >= mWaiting.peek().length) {
pending.order(order);
Waiter next = mWaiting.poll().onDataAvailable(emitter, pending);
if (next != null) mWaiting.addFirst(next);
}
if (mWaiting.size() == 0)
pending.get(bb);
}
public void tap(TapCallback callback) {
mWaiting.add(new TapWaiter(callback));
}
static Hashtable<Class, Method> mTable = new Hashtable<Class, Method>();
static Method getTap(TapCallback callback) {
Method found = mTable.get(callback.getClass());
if (found != null)
return found;
for (Method method : callback.getClass().getMethods()) {
if ("tap".equals(method.getName())) {
mTable.put(callback.getClass(), method);
return method;
}
}
// try the proguard friendly route, take the first/only method
// in case "tap" has been renamed
Method[] candidates = callback.getClass().getDeclaredMethods();
if (candidates.length == 1)
return candidates[0];
String fail =
"-keep class * extends com.koushikdutta.async.TapCallback {\n" +
" *;\n" +
"}\n";
//null != "AndroidAsync: tap callback could not be found. Proguard? Use this in your proguard config:\n" + fail;
throw new AssertionError(fail);
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/SelectorWrapper.java
================================================
package com.jeffmony.async;
import java.io.Closeable;
import java.io.IOException;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.util.Set;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* Created by koush on 2/13/14.
*/
class SelectorWrapper implements Closeable {
private Selector selector;
public AtomicBoolean isWaking = new AtomicBoolean(false);
Semaphore semaphore = new Semaphore(0);
public Selector getSelector() {
return selector;
}
public SelectorWrapper(Selector selector) {
this.selector = selector;
}
public int selectNow() throws IOException {
return selector.selectNow();
}
public void select() throws IOException {
select(0);
}
public void select(long timeout) throws IOException {
try {
semaphore.drainPermits();
selector.select(timeout);
}
finally {
semaphore.release(Integer.MAX_VALUE);
}
}
public Set<SelectionKey> keys() {
return selector.keys();
}
public Set<SelectionKey> selectedKeys() {
return selector.selectedKeys();
}
@Override
public void close() throws IOException {
selector.close();
}
public boolean isOpen() {
return selector.isOpen();
}
public void wakeupOnce() {
// see if it is selecting, ie, can't acquire a permit
boolean selecting = !semaphore.tryAcquire();
selector.wakeup();
// if it was selecting, then the wakeup definitely worked.
if (selecting)
return;
// now, we NEED to wait for the select to start to forcibly wake it.
if (isWaking.getAndSet(true)) {
selector.wakeup();
return;
}
try {
waitForSelect();
selector.wakeup();
} finally {
isWaking.set(false);
}
}
public boolean waitForSelect() {
// try to wake up 10 times
for (int i = 0; i < 100; i++) {
try {
if (semaphore.tryAcquire(10, TimeUnit.MILLISECONDS)) {
// successfully acquiring means the selector is NOT selecting, since select
// will drain all permits.
continue;
}
} catch (InterruptedException e) {
// an InterruptedException means the acquire failed a select is in progress,
// since it holds all permits
return true;
}
}
return false;
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/ServerSocketChannelWrapper.java
================================================
package com.jeffmony.async;
import java.io.IOException;
import java.net.InetAddress;
import java.nio.ByteBuffer;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
class ServerSocketChannelWrapper extends ChannelWrapper {
ServerSocketChannel mChannel;
@Override
public void shutdownOutput() {
}
@Override
public void shutdownInput() {
}
@Override
public InetAddress getLocalAddress() {
return mChannel.socket().getInetAddress();
}
@Override
public int getLocalPort() {
return mChannel.socket().getLocalPort();
}
ServerSocketChannelWrapper(ServerSocketChannel channel) throws IOException {
super(channel);
mChannel = channel;
}
@Override
public int read(ByteBuffer buffer) throws IOException {
final String msg = "Can't read ServerSocketChannel";
assert false;
throw new IOException(msg);
}
@Override
public boolean isConnected() {
assert false;
return false;
}
@Override
public int write(ByteBuffer src) throws IOException {
final String msg = "Can't write ServerSocketChannel";
assert false;
throw new IOException(msg);
}
@Override
public SelectionKey register(Selector sel) throws ClosedChannelException {
return mChannel.register(sel, SelectionKey.OP_ACCEPT);
}
@Override
public int write(ByteBuffer[] src) throws IOException {
final String msg = "Can't write ServerSocketChannel";
assert false;
throw new IOException(msg);
}
@Override
public long read(ByteBuffer[] byteBuffers) throws IOException {
final String msg = "Can't read ServerSocketChannel";
assert false;
throw new IOException(msg);
}
@Override
public long read(ByteBuffer[] byteBuffers, int i, int i2) throws IOException {
final String msg = "Can't read ServerSocketChannel";
assert false;
throw new IOException(msg);
}
@Override
public Object getSocket() {
return mChannel.socket();
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/SocketChannelWrapper.java
================================================
package com.jeffmony.async;
import java.io.IOException;
import java.net.InetAddress;
import java.nio.ByteBuffer;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
class SocketChannelWrapper extends ChannelWrapper {
SocketChannel mChannel;
@Override
public InetAddress getLocalAddress() {
return mChannel.socket().getLocalAddress();
}
@Override
public int getLocalPort() {
return mChannel.socket().getLocalPort();
}
SocketChannelWrapper(SocketChannel channel) throws IOException {
super(channel);
mChannel = channel;
}
@Override
public int read(ByteBuffer buffer) throws IOException {
return mChannel.read(buffer);
}
@Override
public boolean isConnected() {
return mChannel.isConnected();
}
@Override
public int write(ByteBuffer src) throws IOException {
return mChannel.write(src);
}
@Override
public int write(ByteBuffer[] src) throws IOException {
return (int)mChannel.write(src);
}
@Override
public SelectionKey register(Selector sel) throws ClosedChannelException {
return register(sel, SelectionKey.OP_CONNECT);
}
@Override
public void shutdownOutput() {
try {
mChannel.socket().shutdownOutput();
}
catch (Exception e) {
}
}
@Override
public void shutdownInput() {
try {
mChannel.socket().shutdownInput();
}
catch (Exception e) {
}
}
@Override
public long read(ByteBuffer[] byteBuffers) throws IOException {
return mChannel.read(byteBuffers);
}
@Override
public long read(ByteBuffer[] byteBuffers, int i, int i2) throws IOException {
return mChannel.read(byteBuffers, i, i2);
}
@Override
public Object getSocket() {
return mChannel.socket();
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/TapCallback.java
================================================
package com.jeffmony.async;
public interface TapCallback {
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/ThreadQueue.java
================================================
package com.jeffmony.async;
import java.util.LinkedList;
import java.util.WeakHashMap;
import java.util.concurrent.Semaphore;
class ThreadQueue extends LinkedList<Runnable> {
final private static WeakHashMap<Thread, ThreadQueue> mThreadQueues = new WeakHashMap<Thread, ThreadQueue>();
static ThreadQueue getOrCreateThreadQueue(Thread thread) {
ThreadQueue queue;
synchronized (mThreadQueues) {
queue = mThreadQueues.get(thread);
if (queue == null) {
queue = new ThreadQueue();
mThreadQueues.put(thread, queue);
}
}
return queue;
}
static void release(AsyncSemaphore semaphore) {
synchronized (mThreadQueues) {
for (ThreadQueue threadQueue: mThreadQueues.values()) {
if (threadQueue.waiter == semaphore)
threadQueue.queueSemaphore.release();
}
}
}
AsyncSemaphore waiter;
Semaphore queueSemaphore = new Semaphore(0);
@Override
public boolean add(Runnable object) {
synchronized (this) {
return super.add(object);
}
}
@Override
public boolean remove(Object object) {
synchronized (this) {
return super.remove(object);
}
}
@Override
public Runnable remove() {
synchronized (this) {
if (this.isEmpty())
return null;
return super.remove();
}
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/Util.java
================================================
package com.jeffmony.async;
import com.jeffmony.async.callback.CompletedCallback;
import com.jeffmony.async.callback.DataCallback;
import com.jeffmony.async.callback.WritableCallback;
import com.jeffmony.async.util.Allocator;
import com.jeffmony.async.util.StreamUtility;
import com.jeffmony.async.wrapper.AsyncSocketWrapper;
import com.jeffmony.async.wrapper.DataEmitterWrapper;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
public class Util {
public static boolean SUPRESS_DEBUG_EXCEPTIONS = false;
public static void emitAllData(DataEmitter emitter, ByteBufferList list) {
int remaining;
DataCallback handler = null;
while (!emitter.isPaused() && (handler = emitter.getDataCallback()) != null && (remaining = list.remaining()) > 0) {
handler.onDataAvailable(emitter, list);
if (remaining == list.remaining() && handler == emitter.getDataCallback() && !emitter.isPaused()) {
// this is generally indicative of failure...
// 1) The data callback has not changed
// 2) no data was consumed
// 3) the data emitter was not paused
// call byteBufferList.recycle() or read all the data to prevent this assertion.
// this is nice to have, as it identifies protocol or parsing errors.
// System.out.println("Data: " + list.peekString());
System.out.println("handler: " + handler);
list.recycle();
if (SUPRESS_DEBUG_EXCEPTIONS)
return;
assert false;
throw new RuntimeException("mDataHandler failed to consume data, yet remains the mDataHandler.");
}
}
if (list.remaining() != 0 && !emitter.isPaused()) {
// not all the data was consumed...
// call byteBufferList.recycle() or read all the data to prevent this assertion.
// this is nice to have, as it identifies protocol or parsing errors.
// System.out.println("Data: " + list.peekString());
System.out.println("handler: " + handler);
System.out.println("emitter: " + emitter);
list.recycle();
if (SUPRESS_DEBUG_EXCEPTIONS)
return;
// assert false;
// throw new AssertionError("Not all data was consumed by Util.emitAllData");
}
}
public static void pump(final InputStream is, final DataSink ds, final CompletedCallback callback) {
pump(is, Integer.MAX_VALUE, ds, callback);
}
public static void pump(final InputStream is, final long max, final DataSink ds, final CompletedCallback callback) {
final CompletedCallback wrapper = new CompletedCallback() {
boolean reported;
@Override
public void onCompleted(Exception ex) {
if (reported)
return;
reported = true;
callback.onCompleted(ex);
}
};
final WritableCallback cb = new WritableCallback() {
int totalRead = 0;
private void cleanup() {
ds.setClosedCallback(null);
ds.setWriteableCallback(null);
pending.recycle();
StreamUtility.closeQuietly(is);
}
ByteBufferList pending = new ByteBufferList();
Allocator allocator = new Allocator().setMinAlloc((int) Math.min(2 << 19, max));
@Override
public void onWriteable() {
try {
do {
if (!pending.hasRemaining()) {
ByteBuffer b = allocator.allocate();
long toRead = Math.min(max - totalRead, b.capacity());
int read = is.read(b.array(), 0, (int)toRead);
if (read == -1 || totalRead == max) {
cleanup();
wrapper.onCompleted(null);
return;
}
allocator.track(read);
totalRead += read;
b.position(0);
b.limit(read);
pending.add(b);
}
ds.write(pending);
}
while (!pending.hasRemaining());
}
catch (Exception e) {
cleanup();
wrapper.onCompleted(e);
}
}
};
ds.setWriteableCallback(cb);
ds.setClosedCallback(wrapper);
cb.onWriteable();
}
public static void pump(final DataEmitter emitter, final DataSink sink, final CompletedCallback callback) {
final DataCallback dataCallback = new DataCallback() {
@Override
public void onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
sink.write(bb);
if (bb.remaining() > 0)
emitter.pause();
}
};
emitter.setDataCallback(dataCallback);
sink.setWriteableCallback(new WritableCallback() {
@Override
public void onWriteable() {
emitter.resume();
}
});
final CompletedCallback wrapper = new CompletedCallback() {
boolean reported;
@Override
public void onCompleted(Exception ex) {
if (reported)
return;
reported = true;
emitter.setDataCallback(null);
emitter.setEndCallback(null);
sink.setClosedCallback(null);
sink.setWriteableCallback(null);
callback.onCompleted(ex);
}
};
emitter.setEndCallback(wrapper);
sink.setClosedCallback(new CompletedCallback() {
@Override
public void onCompleted(Exception ex) {
if (ex == null)
ex = new IOException("sink was closed before emitter ended");
wrapper.onCompleted(ex);
}
});
}
public static void stream(AsyncSocket s1, AsyncSocket s2, CompletedCallback callback) {
pump(s1, s2, callback);
pump(s2, s1, callback);
}
public static void pump(final File file, final DataSink ds, final CompletedCallback callback) {
try {
if (file == null || ds == null) {
callback.onCompleted(null);
return;
}
final InputStream is = new FileInputStream(file);
pump(is, ds, new CompletedCallback() {
@Override
public void onCompleted(Exception ex) {
try {
is.close();
callback.onCompleted(ex);
}
catch (IOException e) {
callback.onCompleted(e);
}
}
});
}
catch (Exception e) {
callback.onCompleted(e);
}
}
public static void writeAll(final DataSink sink, final ByteBufferList bb, final CompletedCallback callback) {
WritableCallback wc;
sink.setWriteableCallback(wc = new WritableCallback() {
@Override
public void onWriteable() {
sink.write(bb);
if (bb.remaining() == 0 && callback != null) {
sink.setWriteableCallback(null);
callback.onCompleted(null);
}
}
});
wc.onWriteable();
}
public static void writeAll(DataSink sink, byte[] bytes, CompletedCallback callback) {
ByteBuffer bb = ByteBufferList.obtain(bytes.length);
bb.put(bytes);
bb.flip();
ByteBufferList bbl = new ByteBufferList();
bbl.add(bb);
writeAll(sink, bbl, callback);
}
public static <T extends AsyncSocket> T getWrappedSocket(AsyncSocket socket, Class<T> wrappedClass) {
if (wrappedClass.isInstance(socket))
return (T)socket;
while (socket instanceof AsyncSocketWrapper) {
socket = ((AsyncSocketWrapper)socket).getSocket();
if (wrappedClass.isInstance(socket))
return (T)socket;
}
return null;
}
public static DataEmitter getWrappedDataEmitter(DataEmitter emitter, Class wrappedClass) {
if (wrappedClass.isInstance(emitter))
return emitter;
while (emitter instanceof DataEmitterWrapper) {
emitter = ((AsyncSocketWrapper)emitter).getSocket();
if (wrappedClass.isInstance(emitter))
return emitter;
}
return null;
}
public static void end(DataEmitter emitter, Exception e) {
if (emitter == null)
return;
end(emitter.getEndCallback(), e);
}
public static void end(CompletedCallback end, Exception e) {
if (end != null)
end.onCompleted(e);
}
public static void writable(DataSink emitter) {
if (emitter == null)
return;
writable(emitter.getWriteableCallback());
}
public static void writable(WritableCallback writable) {
if (writable != null)
writable.onWriteable();
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/ZipDataSink.java
================================================
package com.jeffmony.async;
import com.jeffmony.async.callback.CompletedCallback;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class ZipDataSink extends FilteredDataSink {
public ZipDataSink(DataSink sink) {
super(sink);
}
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ZipOutputStream zop = new ZipOutputStream(bout);
public void putNextEntry(ZipEntry ze) throws IOException {
zop.putNextEntry(ze);
}
public void closeEntry() throws IOException {
zop.closeEntry();
}
protected void report(Exception e) {
CompletedCallback closed = getClosedCallback();
if (closed != null)
closed.onCompleted(e);
}
@Override
public void end() {
try {
zop.close();
}
catch (IOException e) {
report(e);
return;
}
setMaxBuffer(Integer.MAX_VALUE);
write(new ByteBufferList());
super.end();
}
@Override
public ByteBufferList filter(ByteBufferList bb) {
try {
if (bb != null) {
while (bb.size() > 0) {
ByteBuffer b = bb.remove();
ByteBufferList.writeOutputStream(zop, b);
ByteBufferList.reclaim(b);
}
}
ByteBufferList ret = new ByteBufferList(bout.toByteArray());
bout.reset();
return ret;
}
catch (IOException e) {
report(e);
return null;
}
finally {
if (bb != null)
bb.recycle();
}
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/callback/CompletedCallback.java
================================================
package com.jeffmony.async.callback;
public interface CompletedCallback {
class NullCompletedCallback implements CompletedCallback {
@Override
public void onCompleted(Exception ex) {
}
}
public void onCompleted(Exception ex);
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/callback/ConnectCallback.java
================================================
package com.jeffmony.async.callback;
import com.jeffmony.async.AsyncSocket;
public interface ConnectCallback {
void onConnectCompleted(Exception ex, AsyncSocket socket);
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/callback/ContinuationCallback.java
================================================
package com.jeffmony.async.callback;
import com.jeffmony.async.future.Continuation;
public interface ContinuationCallback {
void onContinue(Continuation continuation, CompletedCallback next) throws Exception;
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/callback/DataCallback.java
================================================
package com.jeffmony.async.callback;
import com.jeffmony.async.ByteBufferList;
import com.jeffmony.async.DataEmitter;
public interface DataCallback {
class NullDataCallback implements DataCallback {
@Override
public void onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
bb.recycle();
}
}
void onDataAvailable(DataEmitter emitter, ByteBufferList bb);
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/callback/ListenCallback.java
================================================
package com.jeffmony.async.callback;
import com.jeffmony.async.AsyncServerSocket;
import com.jeffmony.async.AsyncSocket;
public interface ListenCallback extends CompletedCallback {
void onAccepted(AsyncSocket socket);
void onListening(AsyncServerSocket socket);
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/callback/ResultCallback.java
================================================
package com.jeffmony.async.callback;
public interface ResultCallback<S, T> {
public void onCompleted(Exception e, S source, T result);
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/callback/SocketCreateCallback.java
================================================
package com.jeffmony.async.callback;
public interface SocketCreateCallback {
void onSocketCreated(int localPort);
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/callback/ValueCallback.java
================================================
package com.jeffmony.async.callback;
/**
* Created by koush on 7/5/16.
*/
public interface ValueCallback<T> {
void onResult(T value);
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/callback/ValueFunction.java
================================================
package com.jeffmony.async.callback;
public interface ValueFunction<T> {
T getValue() throws Exception;
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/callback/WritableCallback.java
================================================
package com.jeffmony.async.callback;
public interface WritableCallback {
public void onWriteable();
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/dns/Dns.java
================================================
package com.jeffmony.async.dns;
import com.jeffmony.async.AsyncDatagramSocket;
import com.jeffmony.async.AsyncServer;
import com.jeffmony.async.ByteBufferList;
import com.jeffmony.async.DataEmitter;
import com.jeffmony.async.callback.DataCallback;
import com.jeffmony.async.future.Cancellable;
import com.jeffmony.async.future.Future;
import com.jeffmony.async.future.FutureCallback;
import com.jeffmony.async.future.SimpleFuture;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Random;
/**
* Created by koush on 10/20/13.
*/
public class Dns {
public static Future<DnsResponse> lookup(String host) {
return lookup(AsyncServer.getDefault(), host, false, null);
}
private static int setFlag(int flags, int value, int offset) {
return flags | (value << offset);
}
private static int setQuery(int flags) {
return setFlag(flags, 0, 0);
}
private static int setRecursion(int flags) {
return setFlag(flags, 1, 8);
}
private static void addName(ByteBuffer bb, String name) {
String[] parts = name.split("\\.");
for (String part: parts) {
bb.put((byte)part.length());
bb.put(part.getBytes());
}
bb.put((byte)0);
}
public static Future<DnsResponse> lookup(AsyncServer server, String host) {
return lookup(server, host, false, null);
}
public static Cancellable multicastLookup(AsyncServer server, String host, FutureCallback<DnsResponse> callback) {
return lookup(server, host, true, callback);
}
public static Cancellable multicastLookup(String host, FutureCallback<DnsResponse> callback) {
return multicastLookup(AsyncServer.getDefault(), host, callback);
}
public static Future<DnsResponse> lookup(AsyncServer server, String host, final boolean multicast, final FutureCallback<DnsResponse> callback) {
if (!server.isAffinityThread()) {
SimpleFuture<DnsResponse> ret = new SimpleFuture<>();
server.post(() -> ret.setComplete(lookup(server, host, multicast, callback)));
return ret;
}
ByteBuffer packet = ByteBufferList.obtain(1024).order(ByteOrder.BIG_ENDIAN);
short id = (short)new Random().nextInt();
short flags = (short)setQuery(0);
if (!multicast)
flags = (short)setRecursion(flags);
packet.putShort(id);
packet.putShort(flags);
// number questions
packet.putShort(multicast ? (short)1 : (short)2);
// number answer rr
packet.putShort((short)0);
// number authority rr
packet.putShort((short)0);
// number additional rr
packet.putShort((short)0);
addName(packet, host);
// query
packet.putShort(multicast ? (short)12 : (short)1);
// request internet address
packet.putShort((short)1);
if (!multicast) {
addName(packet, host);
// AAAA query
packet.putShort((short) 28);
// request internet address
packet.putShort((short)1);
}
packet.flip();
try {
final AsyncDatagramSocket dgram;
// todo, use the dns server...
if (!multicast) {
dgram = server.connectDatagram(new InetSocketAddress("8.8.8.8", 53));
}
else {
// System.out.println("multicast dns...");
dgram = AsyncServer.getDefault().openDatagram(null, 0, true);
Field field = DatagramSocket.class.getDeclaredField("impl");
field.setAccessible(true);
Object impl = field.get(dgram.getSocket());
Method method = impl.getClass().getDeclaredMethod("join", InetAddress.class);
method.setAccessible(true);
method.invoke(impl, InetAddress.getByName("224.0.0.251"));
((DatagramSocket)dgram.getSocket()).setBroadcast(true);
}
final SimpleFuture<DnsResponse> ret = new SimpleFuture<DnsResponse>() {
@Override
protected void cleanup() {
super.cleanup();
// System.out.println("multicast dns cleanup...");
dgram.close();
}
};
dgram.setDataCallback(new DataCallback() {
@Override
public void onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
try {
// System.out.println(dgram.getRemoteAddress());
DnsResponse response = DnsResponse.parse(bb);
// System.out.println(response);
response.source = dgram.getRemoteAddress();
if (!multicast) {
dgram.close();
ret.setComplete(response);
}
else {
callback.onCompleted(null, response);
}
}
catch (Exception e) {
}
bb.recycle();
}
});
if (!multicast)
dgram.write(new ByteBufferList(packet));
else
dgram.send(new InetSocketAddress("224.0.0.251", 5353), packet);
return ret;
}
catch (Exception e) {
SimpleFuture<DnsResponse> ret = new SimpleFuture<DnsResponse>();
ret.setComplete(e);
if (multicast)
callback.onCompleted(e, null);
return ret;
}
}
}
================================================
FILE: androidasync/src/main/java/com/jeffmony/async/dns/DnsResponse.java
================================================
package com.jeffmony.async.dns;
import com.jeffmony.async.ByteBufferList;
import com.jeffmony.async.http.Multimap;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
/**
* Created by koush on 10/20/13.
*/
public class DnsResponse {
public ArrayList<InetAddress> addresses = new ArrayList<InetAddress>();
public ArrayList<String> names = new ArrayList<String>();
public Multimap txt = new Multimap();
public InetSocketAddress source;
private static String parseName(ByteBufferList bb, ByteBuffer backReference) {
bb.order(ByteOrder.BIG_ENDIAN);
String ret = "";
int len;
while (0 != (len = bb.get() & 0x00FF)) {
// compressed
if ((len & 0x00c0) == 0x00c0) {
int offset = ((len & ~0xFFFFFFc0) << 8) | (bb.get() & 0x00FF);
if (ret.length() > 0)
ret += ".";
ByteBufferList sub = new ByteBufferList();
ByteBuffer duplicate = backReference.duplicate();
duplicate.get(new byte[offset]);
sub.add(duplicate);
return ret + parseName(sub, backReference);
}
byte[] bytes = new byte[len];
bb.get(bytes);
if (ret.length() > 0)
ret += ".";
ret += new String(bytes);
}
return ret;
}
public static DnsResponse parse(ByteBufferList bb) {
ByteBuffer b = bb.getAll();
bb.add(b.duplicate());
// naive parsing...
bb.order(ByteOrder.BIG_ENDIAN);
// id
bb.getShort();
// flags
bb.getShort();
// number questions
int questions = bb.getShort();
// number answer rr
int answers = bb.getShort();
// number authority rr
int authorities = bb.getShort();
// number additional rr
int additionals = bb.getShort();
for (int i = 0; i < questions; i++) {
parseName(bb, b);
// type
bb.getShort();
// class
bb.getShort();
}
DnsResponse response = new DnsResponse();
for (int i = 0; i < answers; i++) {
String name = parseName(bb, b);
// type
int type = bb.getShort();
// class
int clazz = bb.getShort();
// ttl
int ttl = bb.getInt();
// length of address
int length = bb.getShort();
try {
if (type == 1) {
// data
byte[] data = new byte[length];
bb.get(data);
response.addresses.add(InetAddress.getByAddress(data));
}
else if (type == 0x000c) {
response.names.add(parseName(bb, b));
}
else if (type == 16) {
ByteBufferList txt = new ByteBufferList();
bb.get(txt, length);
response.parseTxt(txt);
}
else {
bb.get(new byte[length]);
}
}
catch (Exception e) {
// e.printStackTrace();
}
}
// authorities
for (int i = 0; i < authorities; i++) {
String name = parseName(bb, b);
// type
int type = bb.getShort();
// class
int clazz = bb.getShort();
// ttl
int ttl = bb.getInt();
// length of address
int length = bb.getShort();
try {
bb.get(new byte[length]);
}
catch (Exception e) {
// e.printStackTrace();
}
}
// additionals
for (int i = 0; i < additionals; i++) {
String name = parseName(bb, b);
// type
int type = bb.getShort();
// class
int clazz = bb.getShort();
// ttl
int ttl = bb.getInt();
// length of address
int length = bb.getShort();
t
gitextract_ez39w3qr/ ├── .gitignore ├── LICENSE ├── README.md ├── README_cn.md ├── androidasync/ │ ├── .gitignore │ ├── androidasync.iml │ ├── build.gradle │ ├── consumer-rules.pro │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ └── java/ │ └── com/ │ └── jeffmony/ │ └── async/ │ ├── AsyncDatagramSocket.java │ ├── AsyncNetworkSocket.java │ ├── AsyncSSLException.java │ ├── AsyncSSLServerSocket.java │ ├── AsyncSSLSocket.java │ ├── AsyncSSLSocketWrapper.java │ ├── AsyncSemaphore.java │ ├── AsyncServer.java │ ├── AsyncServerSocket.java │ ├── AsyncSocket.java │ ├── BufferedDataSink.java │ ├── ByteBufferList.java │ ├── ChannelWrapper.java │ ├── DataEmitter.java │ ├── DataEmitterBase.java │ ├── DataEmitterReader.java │ ├── DataSink.java │ ├── DataTrackingEmitter.java │ ├── DatagramChannelWrapper.java │ ├── FileDataEmitter.java │ ├── FilteredDataEmitter.java │ ├── FilteredDataSink.java │ ├── HostnameResolutionException.java │ ├── LineEmitter.java │ ├── PushParser.java │ ├── SelectorWrapper.java │ ├── ServerSocketChannelWrapper.java │ ├── SocketChannelWrapper.java │ ├── TapCallback.java │ ├── ThreadQueue.java │ ├── Util.java │ ├── ZipDataSink.java │ ├── callback/ │ │ ├── CompletedCallback.java │ │ ├── ConnectCallback.java │ │ ├── ContinuationCallback.java │ │ ├── DataCallback.java │ │ ├── ListenCallback.java │ │ ├── ResultCallback.java │ │ ├── SocketCreateCallback.java │ │ ├── ValueCallback.java │ │ ├── ValueFunction.java │ │ └── WritableCallback.java │ ├── dns/ │ │ ├── Dns.java │ │ └── DnsResponse.java │ ├── future/ │ │ ├── Cancellable.java │ │ ├── Continuation.java │ │ ├── Converter.java │ │ ├── DependentCancellable.java │ │ ├── DependentFuture.java │ │ ├── DoneCallback.java │ │ ├── FailCallback.java │ │ ├── FailConvertCallback.java │ │ ├── FailRecoverCallback.java │ │ ├── Future.java │ │ ├── FutureCallback.java │ │ ├── FutureRunnable.java │ │ ├── FutureThread.java │ │ ├── Futures.java │ │ ├── HandlerFuture.java │ │ ├── MultiFuture.java │ │ ├── MultiTransformFuture.java │ │ ├── SimpleCancellable.java │ │ ├── SimpleFuture.java │ │ ├── SuccessCallback.java │ │ ├── ThenCallback.java │ │ ├── ThenFutureCallback.java │ │ ├── TransformFuture.java │ │ └── TypeConverter.java │ ├── http/ │ │ ├── AsyncHttpClient.java │ │ ├── AsyncHttpClientMiddleware.java │ │ ├── AsyncHttpDelete.java │ │ ├── AsyncHttpGet.java │ │ ├── AsyncHttpHead.java │ │ ├── AsyncHttpPost.java │ │ ├── AsyncHttpPut.java │ │ ├── AsyncHttpRequest.java │ │ ├── AsyncHttpResponse.java │ │ ├── AsyncHttpResponseImpl.java │ │ ├── AsyncSSLEngineConfigurator.java │ │ ├── AsyncSSLSocketMiddleware.java │ │ ├── AsyncSocketMiddleware.java │ │ ├── BasicNameValuePair.java │ │ ├── BodyDecoderException.java │ │ ├── ConnectionClosedException.java │ │ ├── ConnectionFailedException.java │ │ ├── Headers.java │ │ ├── HttpDate.java │ │ ├── HttpTransportMiddleware.java │ │ ├── HttpUtil.java │ │ ├── HybiParser.java │ │ ├── Multimap.java │ │ ├── NameValuePair.java │ │ ├── Protocol.java │ │ ├── ProtocolVersion.java │ │ ├── RedirectLimitExceededException.java │ │ ├── RequestLine.java │ │ ├── SSLEngineSNIConfigurator.java │ │ ├── SimpleMiddleware.java │ │ ├── TaggedList.java │ │ ├── WebSocket.java │ │ ├── WebSocketHandshakeException.java │ │ ├── WebSocketImpl.java │ │ ├── body/ │ │ │ ├── AsyncHttpRequestBody.java │ │ │ ├── ByteBufferListRequestBody.java │ │ │ ├── DocumentBody.java │ │ │ ├── FileBody.java │ │ │ ├── FilePart.java │ │ │ ├── JSONArrayBody.java │ │ │ ├── JSONObjectBody.java │ │ │ ├── MultipartFormDataBody.java │ │ │ ├── Part.java │ │ │ ├── StreamBody.java │ │ │ ├── StreamPart.java │ │ │ ├── StringBody.java │ │ │ ├── StringPart.java │ │ │ └── UrlEncodedFormBody.java │ │ ├── cache/ │ │ │ ├── HeaderParser.java │ │ │ ├── Objects.java │ │ │ ├── RawHeaders.java │ │ │ ├── RequestHeaders.java │ │ │ ├── ResponseCacheMiddleware.java │ │ │ ├── ResponseHeaders.java │ │ │ ├── ResponseSource.java │ │ │ └── StrictLineReader.java │ │ ├── callback/ │ │ │ ├── HttpConnectCallback.java │ │ │ └── RequestCallback.java │ │ ├── filter/ │ │ │ ├── ChunkedDataException.java │ │ │ ├── ChunkedInputFilter.java │ │ │ ├── ChunkedOutputFilter.java │ │ │ ├── ContentLengthFilter.java │ │ │ ├── DataRemainingException.java │ │ │ ├── GZIPInputFilter.java │ │ │ ├── InflaterInputFilter.java │ │ │ └── PrematureDataEndException.java │ │ └── server/ │ │ ├── AsyncHttpRequestBodyProvider.java │ │ ├── AsyncHttpServer.java │ │ ├── AsyncHttpServerRequest.java │ │ ├── AsyncHttpServerRequestImpl.java │ │ ├── AsyncHttpServerResponse.java │ │ ├── AsyncHttpServerResponseImpl.java │ │ ├── AsyncHttpServerRouter.java │ │ ├── AsyncProxyServer.java │ │ ├── BoundaryEmitter.java │ │ ├── HttpServerRequestCallback.java │ │ ├── MalformedRangeException.java │ │ ├── MimeEncodingException.java │ │ ├── RouteMatcher.java │ │ ├── StreamSkipException.java │ │ └── UnknownRequestBody.java │ ├── parser/ │ │ ├── AsyncParser.java │ │ ├── ByteBufferListParser.java │ │ ├── DocumentParser.java │ │ ├── JSONArrayParser.java │ │ ├── JSONObjectParser.java │ │ └── StringParser.java │ ├── stream/ │ │ ├── ByteBufferListInputStream.java │ │ ├── FileDataSink.java │ │ ├── InputStreamDataEmitter.java │ │ ├── OutputStreamDataCallback.java │ │ └── OutputStreamDataSink.java │ ├── util/ │ │ ├── Allocator.java │ │ ├── ArrayDeque.java │ │ ├── Charsets.java │ │ ├── Deque.java │ │ ├── FileCache.java │ │ ├── FileUtility.java │ │ ├── HashList.java │ │ ├── IdleTimeout.java │ │ ├── LruCache.java │ │ ├── StreamUtility.java │ │ ├── TaggedList.java │ │ ├── ThrottleTimeout.java │ │ ├── TimeoutBase.java │ │ └── UntypedHashtable.java │ └── wrapper/ │ ├── AsyncSocketWrapper.java │ └── DataEmitterWrapper.java ├── app/ │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── assets/ │ │ └── list.json │ ├── java/ │ │ └── com/ │ │ └── android/ │ │ └── media/ │ │ ├── DownloadBaseListActivity.java │ │ ├── DownloadFeatureActivity.java │ │ ├── DownloadOrcodeActivity.java │ │ ├── DownloadPlayActivity.java │ │ ├── DownloadSettingsActivity.java │ │ ├── MainActivity.java │ │ ├── MediaScannerActivity.java │ │ ├── MyApplication.java │ │ ├── PlayFeatureActivity.java │ │ ├── PlayerActivity.java │ │ └── VideoListAdapter.java │ └── res/ │ ├── drawable/ │ │ ├── border.xml │ │ └── ic_launcher_background.xml │ ├── drawable-v24/ │ │ └── ic_launcher_foreground.xml │ ├── layout/ │ │ ├── activity_download_feature.xml │ │ ├── activity_download_list.xml │ │ ├── activity_download_play.xml │ │ ├── activity_download_settings.xml │ │ ├── activity_main.xml │ │ ├── activity_orcode.xml │ │ ├── activity_play_func.xml │ │ ├── activity_player.xml │ │ ├── activity_scanner.xml │ │ ├── download_item.xml │ │ └── video_item.xml │ ├── mipmap-anydpi-v26/ │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ └── values/ │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── base/ │ ├── .gitignore │ ├── base.iml │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── android/ │ │ └── baselib/ │ │ ├── MediaSDKReceiver.java │ │ ├── NetworkCallbackImpl.java │ │ ├── NetworkListener.java │ │ ├── WeakHandler.java │ │ └── utils/ │ │ ├── LogUtils.java │ │ ├── NetworkUtils.java │ │ ├── ScreenUtils.java │ │ └── Utility.java │ └── res/ │ └── values/ │ └── strings.xml ├── build.gradle ├── constants.gradle ├── exoplayer/ │ ├── .gitignore │ ├── build.gradle │ ├── exoplayer.iml │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── google/ │ │ └── android/ │ │ └── exoplayer2/ │ │ ├── AudioBecomingNoisyManager.java │ │ ├── AudioFocusManager.java │ │ ├── BasePlayer.java │ │ ├── BaseRenderer.java │ │ ├── C.java │ │ ├── ControlDispatcher.java │ │ ├── DefaultControlDispatcher.java │ │ ├── DefaultLoadControl.java │ │ ├── DefaultMediaClock.java │ │ ├── DefaultRenderersFactory.java │ │ ├── ExoPlaybackException.java │ │ ├── ExoPlayer.java │ │ ├── ExoPlayerFactory.java │ │ ├── ExoPlayerImpl.java │ │ ├── ExoPlayerImplInternal.java │ │ ├── ExoPlayerLibraryInfo.java │ │ ├── Format.java │ │ ├── FormatHolder.java │ │ ├── IllegalSeekPositionException.java │ │ ├── LoadControl.java │ │ ├── MediaPeriodHolder.java │ │ ├── MediaPeriodInfo.java │ │ ├── MediaPeriodQueue.java │ │ ├── NoSampleRenderer.java │ │ ├── ParserException.java │ │ ├── PlaybackInfo.java │ │ ├── PlaybackParameters.java │ │ ├── PlaybackPreparer.java │ │ ├── Player.java │ │ ├── PlayerMessage.java │ │ ├── Renderer.java │ │ ├── RendererCapabilities.java │ │ ├── RendererConfiguration.java │ │ ├── RenderersFactory.java │ │ ├── SeekParameters.java │ │ ├── SimpleExoPlayer.java │ │ ├── Timeline.java │ │ ├── WakeLockManager.java │ │ ├── analytics/ │ │ │ ├── AnalyticsCollector.java │ │ │ ├── AnalyticsListener.java │ │ │ ├── DefaultAnalyticsListener.java │ │ │ ├── DefaultPlaybackSessionManager.java │ │ │ ├── PlaybackSessionManager.java │ │ │ ├── PlaybackStats.java │ │ │ ├── PlaybackStatsListener.java │ │ │ └── package-info.java │ │ ├── audio/ │ │ │ ├── Ac3Util.java │ │ │ ├── Ac4Util.java │ │ │ ├── AudioAttributes.java │ │ │ ├── AudioCapabilities.java │ │ │ ├── AudioCapabilitiesReceiver.java │ │ │ ├── AudioDecoderException.java │ │ │ ├── AudioListener.java │ │ │ ├── AudioProcessor.java │ │ │ ├── AudioRendererEventListener.java │ │ │ ├── AudioSink.java │ │ │ ├── AudioTimestampPoller.java │ │ │ ├── AudioTrackPositionTracker.java │ │ │ ├── AuxEffectInfo.java │ │ │ ├── BaseAudioProcessor.java │ │ │ ├── ChannelMappingAudioProcessor.java │ │ │ ├── DefaultAudioSink.java │ │ │ ├── DtsUtil.java │ │ │ ├── FloatResamplingAudioProcessor.java │ │ │ ├── MediaCodecAudioRenderer.java │ │ │ ├── ResamplingAudioProcessor.java │ │ │ ├── SilenceSkippingAudioProcessor.java │ │ │ ├── SimpleDecoderAudioRenderer.java │ │ │ ├── Sonic.java │ │ │ ├── SonicAudioProcessor.java │ │ │ ├── TeeAudioProcessor.java │ │ │ ├── TrimmingAudioProcessor.java │ │ │ ├── WavUtil.java │ │ │ └── package-info.java │ │ ├── database/ │ │ │ ├── DatabaseIOException.java │ │ │ ├── DatabaseProvider.java │ │ │ ├── DefaultDatabaseProvider.java │ │ │ ├── ExoDatabaseProvider.java │ │ │ ├── VersionTable.java │ │ │ └── package-info.java │ │ ├── decoder/ │ │ │ ├── Buffer.java │ │ │ ├── CryptoInfo.java │ │ │ ├── Decoder.java │ │ │ ├── DecoderCounters.java │ │ │ ├── DecoderInputBuffer.java │ │ │ ├── OutputBuffer.java │ │ │ ├── SimpleDecoder.java │ │ │ ├── SimpleOutputBuffer.java │ │ │ └── package-info.java │ │ ├── drm/ │ │ │ ├── ClearKeyUtil.java │ │ │ ├── DecryptionException.java │ │ │ ├── DefaultDrmSession.java │ │ │ ├── DefaultDrmSessionEventListener.java │ │ │ ├── DefaultDrmSessionManager.java │ │ │ ├── DrmInitData.java │ │ │ ├── DrmSession.java │ │ │ ├── DrmSessionManager.java │ │ │ ├── DummyExoMediaDrm.java │ │ │ ├── ErrorStateDrmSession.java │ │ │ ├── ExoMediaCrypto.java │ │ │ ├── ExoMediaDrm.java │ │ │ ├── FrameworkMediaCrypto.java │ │ │ ├── FrameworkMediaDrm.java │ │ │ ├── HttpMediaDrmCallback.java │ │ │ ├── KeysExpiredException.java │ │ │ ├── LocalMediaDrmCallback.java │ │ │ ├── MediaDrmCallback.java │ │ │ ├── OfflineLicenseHelper.java │ │ │ ├── UnsupportedDrmException.java │ │ │ ├── WidevineUtil.java │ │ │ └── package-info.java │ │ ├── extractor/ │ │ │ ├── BinarySearchSeeker.java │ │ │ ├── ChunkIndex.java │ │ │ ├── ConstantBitrateSeekMap.java │ │ │ ├── DefaultExtractorInput.java │ │ │ ├── DefaultExtractorsFactory.java │ │ │ ├── DummyExtractorOutput.java │ │ │ ├── DummyTrackOutput.java │ │ │ ├── Extractor.java │ │ │ ├── ExtractorInput.java │ │ │ ├── ExtractorOutput.java │ │ │ ├── ExtractorsFactory.java │ │ │ ├── GaplessInfoHolder.java │ │ │ ├── Id3Peeker.java │ │ │ ├── MpegAudioHeader.java │ │ │ ├── PositionHolder.java │ │ │ ├── SeekMap.java │ │ │ ├── SeekPoint.java │ │ │ ├── TrackOutput.java │ │ │ ├── amr/ │ │ │ │ └── AmrExtractor.java │ │ │ ├── flv/ │ │ │ │ ├── AudioTagPayloadReader.java │ │ │ │ ├── FlvExtractor.java │ │ │ │ ├── ScriptTagPayloadReader.java │ │ │ │ ├── TagPayloadReader.java │ │ │ │ └── VideoTagPayloadReader.java │ │ │ ├── mkv/ │ │ │ │ ├── DefaultEbmlReader.java │ │ │ │ ├── EbmlProcessor.java │ │ │ │ ├── EbmlReader.java │ │ │ │ ├── MatroskaExtractor.java │ │ │ │ ├── Sniffer.java │ │ │ │ └── VarintReader.java │ │ │ ├── mp3/ │ │ │ │ ├── ConstantBitrateSeeker.java │ │ │ │ ├── MlltSeeker.java │ │ │ │ ├── Mp3Extractor.java │ │ │ │ ├── Seeker.java │ │ │ │ ├── VbriSeeker.java │ │ │ │ └── XingSeeker.java │ │ │ ├── mp4/ │ │ │ │ ├── Atom.java │ │ │ │ ├── AtomParsers.java │ │ │ │ ├── DefaultSampleValues.java │ │ │ │ ├── FixedSampleSizeRechunker.java │ │ │ │ ├── FragmentedMp4Extractor.java │ │ │ │ ├── MdtaMetadataEntry.java │ │ │ │ ├── MetadataUtil.java │ │ │ │ ├── Mp4Extractor.java │ │ │ │ ├── PsshAtomUtil.java │ │ │ │ ├── Sniffer.java │ │ │ │ ├── Track.java │ │ │ │ ├── TrackEncryptionBox.java │ │ │ │ ├── TrackFragment.java │ │ │ │ └── TrackSampleTable.java │ │ │ ├── ogg/ │ │ │ │ ├── DefaultOggSeeker.java │ │ │ │ ├── FlacReader.java │ │ │ │ ├── OggExtractor.java │ │ │ │ ├── OggPacket.java │ │ │ │ ├── OggPageHeader.java │ │ │ │ ├── OggSeeker.java │ │ │ │ ├── OpusReader.java │ │ │ │ ├── StreamReader.java │ │ │ │ ├── VorbisBitArray.java │ │ │ │ ├── VorbisReader.java │ │ │ │ └── VorbisUtil.java │ │ │ ├── rawcc/ │ │ │ │ └── RawCcExtractor.java │ │ │ ├── ts/ │ │ │ │ ├── Ac3Extractor.java │ │ │ │ ├── Ac3Reader.java │ │ │ │ ├── Ac4Extractor.java │ │ │ │ ├── Ac4Reader.java │ │ │ │ ├── AdtsExtractor.java │ │ │ │ ├── AdtsReader.java │ │ │ │ ├── DefaultTsPayloadReaderFactory.java │ │ │ │ ├── DtsReader.java │ │ │ │ ├── DvbSubtitleReader.java │ │ │ │ ├── ElementaryStreamReader.java │ │ │ │ ├── H262Reader.java │ │ │ │ ├── H264Reader.java │ │ │ │ ├── H265Reader.java │ │ │ │ ├── Id3Reader.java │ │ │ │ ├── LatmReader.java │ │ │ │ ├── MpegAudioReader.java │ │ │ │ ├── NalUnitTargetBuffer.java │ │ │ │ ├── PesReader.java │ │ │ │ ├── PsBinarySearchSeeker.java │ │ │ │ ├── PsDurationReader.java │ │ │ │ ├── PsExtractor.java │ │ │ │ ├── SectionPayloadReader.java │ │ │ │ ├── SectionReader.java │ │ │ │ ├── SeiReader.java │ │ │ │ ├── SpliceInfoSectionReader.java │ │ │ │ ├── TsBinarySearchSeeker.java │ │ │ │ ├── TsDurationReader.java │ │ │ │ ├── TsExtractor.java │ │ │ │ ├── TsPayloadReader.java │ │ │ │ ├── TsUtil.java │ │ │ │ └── UserDataReader.java │ │ │ └── wav/ │ │ │ ├── WavExtractor.java │ │ │ ├── WavHeader.java │ │ │ └── WavHeaderReader.java │ │ ├── mediacodec/ │ │ │ ├── MediaCodecInfo.java │ │ │ ├── MediaCodecRenderer.java │ │ │ ├── MediaCodecSelector.java │ │ │ ├── MediaCodecUtil.java │ │ │ ├── MediaFormatUtil.java │ │ │ └── package-info.java │ │ ├── metadata/ │ │ │ ├── Metadata.java │ │ │ ├── MetadataDecoder.java │ │ │ ├── MetadataDecoderFactory.java │ │ │ ├── MetadataInputBuffer.java │ │ │ ├── MetadataOutput.java │ │ │ ├── MetadataRenderer.java │ │ │ ├── emsg/ │ │ │ │ ├── EventMessage.java │ │ │ │ ├── EventMessageDecoder.java │ │ │ │ ├── EventMessageEncoder.java │ │ │ │ └── package-info.java │ │ │ ├── flac/ │ │ │ │ ├── PictureFrame.java │ │ │ │ ├── VorbisComment.java │ │ │ │ └── package-info.java │ │ │ ├── icy/ │ │ │ │ ├── IcyDecoder.java │ │ │ │ ├── IcyHeaders.java │ │ │ │ ├── IcyInfo.java │ │ │ │ └── package-info.java │ │ │ ├── id3/ │ │ │ │ ├── ApicFrame.java │ │ │ │ ├── BinaryFrame.java │ │ │ │ ├── ChapterFrame.java │ │ │ │ ├── ChapterTocFrame.java │ │ │ │ ├── CommentFrame.java │ │ │ │ ├── GeobFrame.java │ │ │ │ ├── Id3Decoder.java │ │ │ │ ├── Id3Frame.java │ │ │ │ ├── InternalFrame.java │ │ │ │ ├── MlltFrame.java │ │ │ │ ├── PrivFrame.java │ │ │ │ ├── TextInformationFrame.java │ │ │ │ ├── UrlLinkFrame.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── scte35/ │ │ │ ├── PrivateCommand.java │ │ │ ├── SpliceCommand.java │ │ │ ├── SpliceInfoDecoder.java │ │ │ ├── SpliceInsertCommand.java │ │ │ ├── SpliceNullCommand.java │ │ │ ├── SpliceScheduleCommand.java │ │ │ ├── TimeSignalCommand.java │ │ │ └── package-info.java │ │ ├── offline/ │ │ │ ├── ActionFile.java │ │ │ ├── ActionFileUpgradeUtil.java │ │ │ ├── DefaultDownloadIndex.java │ │ │ ├── DefaultDownloaderFactory.java │ │ │ ├── Download.java │ │ │ ├── DownloadCursor.java │ │ │ ├── DownloadException.java │ │ │ ├── DownloadHelper.java │ │ │ ├── DownloadIndex.java │ │ │ ├── DownloadManager.java │ │ │ ├── DownloadProgress.java │ │ │ ├── DownloadRequest.java │ │ │ ├── DownloadService.java │ │ │ ├── Downloader.java │ │ │ ├── DownloaderConstructorHelper.java │ │ │ ├── DownloaderFactory.java │ │ │ ├── FilterableManifest.java │ │ │ ├── FilteringManifestParser.java │ │ │ ├── ProgressiveDownloader.java │ │ │ ├── SegmentDownloader.java │ │ │ ├── StreamKey.java │ │ │ ├── WritableDownloadIndex.java │ │ │ └── package-info.java │ │ ├── package-info.java │ │ ├── scheduler/ │ │ │ ├── PlatformScheduler.java │ │ │ ├── Requirements.java │ │ │ ├── RequirementsWatcher.java │ │ │ ├── Scheduler.java │ │ │ └── package-info.java │ │ ├── source/ │ │ │ ├── AbstractConcatenatedTimeline.java │ │ │ ├── AdaptiveMediaSourceEventListener.java │ │ │ ├── BaseMediaSource.java │ │ │ ├── BehindLiveWindowException.java │ │ │ ├── ClippingMediaPeriod.java │ │ │ ├── ClippingMediaSource.java │ │ │ ├── CompositeMediaSource.java │ │ │ ├── CompositeSequenceableLoader.java │ │ │ ├── CompositeSequenceableLoaderFactory.java │ │ │ ├── ConcatenatingMediaSource.java │ │ │ ├── DefaultCompositeSequenceableLoaderFactory.java │ │ │ ├── DefaultMediaSourceEventListener.java │ │ │ ├── EmptySampleStream.java │ │ │ ├── ExtractorMediaSource.java │ │ │ ├── ForwardingTimeline.java │ │ │ ├── IcyDataSource.java │ │ │ ├── LoopingMediaSource.java │ │ │ ├── MaskingMediaPeriod.java │ │ │ ├── MaskingMediaSource.java │ │ │ ├── MediaPeriod.java │ │ │ ├── MediaSource.java │ │ │ ├── MediaSourceEventListener.java │ │ │ ├── MediaSourceFactory.java │ │ │ ├── MergingMediaPeriod.java │ │ │ ├── MergingMediaSource.java │ │ │ ├── ProgressiveMediaPeriod.java │ │ │ ├── ProgressiveMediaSource.java │ │ │ ├── SampleMetadataQueue.java │ │ │ ├── SampleQueue.java │ │ │ ├── SampleStream.java │ │ │ ├── SequenceableLoader.java │ │ │ ├── ShuffleOrder.java │ │ │ ├── SilenceMediaSource.java │ │ │ ├── SinglePeriodTimeline.java │ │ │ ├── SingleSampleMediaPeriod.java │ │ │ ├── SingleSampleMediaSource.java │ │ │ ├── TrackGroup.java │ │ │ ├── TrackGroupArray.java │ │ │ ├── UnrecognizedInputFormatException.java │ │ │ ├── ads/ │ │ │ │ ├── AdPlaybackState.java │ │ │ │ ├── AdsLoader.java │ │ │ │ ├── AdsMediaSource.java │ │ │ │ └── SinglePeriodAdTimeline.java │ │ │ ├── chunk/ │ │ │ │ ├── BaseMediaChunk.java │ │ │ │ ├── BaseMediaChunkIterator.java │ │ │ │ ├── BaseMediaChunkOutput.java │ │ │ │ ├── Chunk.java │ │ │ │ ├── ChunkExtractorWrapper.java │ │ │ │ ├── ChunkHolder.java │ │ │ │ ├── ChunkSampleStream.java │ │ │ │ ├── ChunkSource.java │ │ │ │ ├── ContainerMediaChunk.java │ │ │ │ ├── DataChunk.java │ │ │ │ ├── InitializationChunk.java │ │ │ │ ├── MediaChunk.java │ │ │ │ ├── MediaChunkIterator.java │ │ │ │ ├── MediaChunkListIterator.java │ │ │ │ └── SingleSampleMediaChunk.java │ │ │ ├── dash/ │ │ │ │ ├── DashChunkSource.java │ │ │ │ ├── DashManifestStaleException.java │ │ │ │ ├── DashMediaPeriod.java │ │ │ │ ├── DashMediaSource.java │ │ │ │ ├── DashSegmentIndex.java │ │ │ │ ├── DashUtil.java │ │ │ │ ├── DashWrappingSegmentIndex.java │ │ │ │ ├── DefaultDashChunkSource.java │ │ │ │ ├── EventSampleStream.java │ │ │ │ ├── PlayerEmsgHandler.java │ │ │ │ ├── manifest/ │ │ │ │ │ ├── AdaptationSet.java │ │ │ │ │ ├── DashManifest.java │ │ │ │ │ ├── DashManifestParser.java │ │ │ │ │ ├── Descriptor.java │ │ │ │ │ ├── EventStream.java │ │ │ │ │ ├── Period.java │ │ │ │ │ ├── ProgramInformation.java │ │ │ │ │ ├── RangedUri.java │ │ │ │ │ ├── Representation.java │ │ │ │ │ ├── SegmentBase.java │ │ │ │ │ ├── SingleSegmentIndex.java │ │ │ │ │ ├── UrlTemplate.java │ │ │ │ │ ├── UtcTimingElement.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── offline/ │ │ │ │ │ ├── DashDownloader.java │ │ │ │ │ └── package-info.java │ │ │ │ └── package-info.java │ │ │ ├── hls/ │ │ │ │ ├── Aes128DataSource.java │ │ │ │ ├── DefaultHlsDataSourceFactory.java │ │ │ │ ├── DefaultHlsExtractorFactory.java │ │ │ │ ├── FullSegmentEncryptionKeyCache.java │ │ │ │ ├── HlsChunkSource.java │ │ │ │ ├── HlsDataSourceFactory.java │ │ │ │ ├── HlsExtractorFactory.java │ │ │ │ ├── HlsManifest.java │ │ │ │ ├── HlsMediaChunk.java │ │ │ │ ├── HlsMediaPeriod.java │ │ │ │ ├── HlsMediaSource.java │ │ │ │ ├── HlsSampleStream.java │ │ │ │ ├── HlsSampleStreamWrapper.java │ │ │ │ ├── HlsTrackMetadataEntry.java │ │ │ │ ├── SampleQueueMappingException.java │ │ │ │ ├── TimestampAdjusterProvider.java │ │ │ │ ├── WebvttExtractor.java │ │ │ │ ├── offline/ │ │ │ │ │ ├── HlsDownloader.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── package-info.java │ │ │ │ └── playlist/ │ │ │ │ ├── DefaultHlsPlaylistParserFactory.java │ │ │ │ ├── DefaultHlsPlaylistTracker.java │ │ │ │ ├── FilteringHlsPlaylistParserFactory.java │ │ │ │ ├── HlsMasterPlaylist.java │ │ │ │ ├── HlsMediaPlaylist.java │ │ │ │ ├── HlsPlaylist.java │ │ │ │ ├── HlsPlaylistParser.java │ │ │ │ ├── HlsPlaylistParserFactory.java │ │ │ │ ├── HlsPlaylistTracker.java │ │ │ │ └── package-info.java │ │ │ └── smoothstreaming/ │ │ │ ├── DefaultSsChunkSource.java │ │ │ ├── SsChunkSource.java │ │ │ ├── SsMediaPeriod.java │ │ │ ├── SsMediaSource.java │ │ │ ├── manifest/ │ │ │ │ ├── SsManifest.java │ │ │ │ ├── SsManifestParser.java │ │ │ │ ├── SsUtil.java │ │ │ │ └── package-info.java │ │ │ ├── offline/ │ │ │ │ ├── SsDownloader.java │ │ │ │ └── package-info.java │ │ │ └── package-info.java │ │ ├── text/ │ │ │ ├── CaptionStyleCompat.java │ │ │ ├── Cue.java │ │ │ ├── SimpleSubtitleDecoder.java │ │ │ ├── SimpleSubtitleOutputBuffer.java │ │ │ ├── Subtitle.java │ │ │ ├── SubtitleDecoder.java │ │ │ ├── SubtitleDecoderException.java │ │ │ ├── SubtitleDecoderFactory.java │ │ │ ├── SubtitleInputBuffer.java │ │ │ ├── SubtitleOutputBuffer.java │ │ │ ├── TextOutput.java │ │ │ ├── TextRenderer.java │ │ │ ├── cea/ │ │ │ │ ├── Cea608Decoder.java │ │ │ │ ├── Cea708Cue.java │ │ │ │ ├── Cea708Decoder.java │ │ │ │ ├── Cea708InitializationData.java │ │ │ │ ├── CeaDecoder.java │ │ │ │ ├── CeaSubtitle.java │ │ │ │ ├── CeaUtil.java │ │ │ │ └── package-info.java │ │ │ ├── dvb/ │ │ │ │ ├── DvbDecoder.java │ │ │ │ ├── DvbParser.java │ │ │ │ ├── DvbSubtitle.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ ├── pgs/ │ │ │ │ ├── PgsDecoder.java │ │ │ │ ├── PgsSubtitle.java │ │ │ │ └── package-info.java │ │ │ ├── ssa/ │ │ │ │ ├── SsaDecoder.java │ │ │ │ ├── SsaDialogueFormat.java │ │ │ │ ├── SsaStyle.java │ │ │ │ ├── SsaSubtitle.java │ │ │ │ └── package-info.java │ │ │ ├── subrip/ │ │ │ │ ├── SubripDecoder.java │ │ │ │ ├── SubripSubtitle.java │ │ │ │ └── package-info.java │ │ │ ├── ttml/ │ │ │ │ ├── TtmlDecoder.java │ │ │ │ ├── TtmlNode.java │ │ │ │ ├── TtmlRegion.java │ │ │ │ ├── TtmlRenderUtil.java │ │ │ │ ├── TtmlStyle.java │ │ │ │ ├── TtmlSubtitle.java │ │ │ │ └── package-info.java │ │ │ ├── tx3g/ │ │ │ │ ├── Tx3gDecoder.java │ │ │ │ ├── Tx3gSubtitle.java │ │ │ │ └── package-info.java │ │ │ └── webvtt/ │ │ │ ├── CssParser.java │ │ │ ├── Mp4WebvttDecoder.java │ │ │ ├── Mp4WebvttSubtitle.java │ │ │ ├── WebvttCssStyle.java │ │ │ ├── WebvttCue.java │ │ │ ├── WebvttCueParser.java │ │ │ ├── WebvttDecoder.java │ │ │ ├── WebvttParserUtil.java │ │ │ ├── WebvttSubtitle.java │ │ │ └── package-info.java │ │ ├── trackselection/ │ │ │ ├── AdaptiveTrackSelection.java │ │ │ ├── BaseTrackSelection.java │ │ │ ├── BufferSizeAdaptationBuilder.java │ │ │ ├── DefaultTrackSelector.java │ │ │ ├── FixedTrackSelection.java │ │ │ ├── MappingTrackSelector.java │ │ │ ├── RandomTrackSelection.java │ │ │ ├── TrackSelection.java │ │ │ ├── TrackSelectionArray.java │ │ │ ├── TrackSelectionParameters.java │ │ │ ├── TrackSelectionUtil.java │ │ │ ├── TrackSelector.java │ │ │ ├── TrackSelectorResult.java │ │ │ └── package-info.java │ │ ├── upstream/ │ │ │ ├── Allocation.java │ │ │ ├── Allocator.java │ │ │ ├── AssetDataSource.java │ │ │ ├── BandwidthMeter.java │ │ │ ├── BaseDataSource.java │ │ │ ├── ByteArrayDataSink.java │ │ │ ├── ByteArrayDataSource.java │ │ │ ├── ContentDataSource.java │ │ │ ├── DataSchemeDataSource.java │ │ │ ├── DataSink.java │ │ │ ├── DataSource.java │ │ │ ├── DataSourceException.java │ │ │ ├── DataSourceInputStream.java │ │ │ ├── DataSpec.java │ │ │ ├── DefaultAllocator.java │ │ │ ├── DefaultBandwidthMeter.java │ │ │ ├── DefaultDataSource.java │ │ │ ├── DefaultDataSourceFactory.java │ │ │ ├── DefaultHttpDataSource.java │ │ │ ├── DefaultHttpDataSourceFactory.java │ │ │ ├── DefaultLoadErrorHandlingPolicy.java │ │ │ ├── DummyDataSource.java │ │ │ ├── FileDataSource.java │ │ │ ├── FileDataSourceFactory.java │ │ │ ├── HttpDataSource.java │ │ │ ├── LoadErrorHandlingPolicy.java │ │ │ ├── Loader.java │ │ │ ├── LoaderErrorThrower.java │ │ │ ├── ParsingLoadable.java │ │ │ ├── PriorityDataSource.java │ │ │ ├── PriorityDataSourceFactory.java │ │ │ ├── RawResourceDataSource.java │ │ │ ├── ResolvingDataSource.java │ │ │ ├── StatsDataSource.java │ │ │ ├── TeeDataSource.java │ │ │ ├── TransferListener.java │ │ │ ├── UdpDataSource.java │ │ │ ├── cache/ │ │ │ │ ├── Cache.java │ │ │ │ ├── CacheDataSink.java │ │ │ │ ├── CacheDataSinkFactory.java │ │ │ │ ├── CacheDataSource.java │ │ │ │ ├── CacheDataSourceFactory.java │ │ │ │ ├── CacheEvictor.java │ │ │ │ ├── CacheFileMetadata.java │ │ │ │ ├── CacheFileMetadataIndex.java │ │ │ │ ├── CacheKeyFactory.java │ │ │ │ ├── CacheSpan.java │ │ │ │ ├── CacheUtil.java │ │ │ │ ├── CachedContent.java │ │ │ │ ├── CachedContentIndex.java │ │ │ │ ├── CachedRegionTracker.java │ │ │ │ ├── ContentMetadata.java │ │ │ │ ├── ContentMetadataMutations.java │ │ │ │ ├── DefaultContentMetadata.java │ │ │ │ ├── LeastRecentlyUsedCacheEvictor.java │ │ │ │ ├── NoOpCacheEvictor.java │ │ │ │ ├── SimpleCache.java │ │ │ │ └── SimpleCacheSpan.java │ │ │ └── crypto/ │ │ │ ├── AesCipherDataSink.java │ │ │ ├── AesCipherDataSource.java │ │ │ ├── AesFlushingCipher.java │ │ │ └── CryptoUtil.java │ │ ├── util/ │ │ │ ├── Assertions.java │ │ │ ├── AtomicFile.java │ │ │ ├── Clock.java │ │ │ ├── CodecSpecificDataUtil.java │ │ │ ├── ColorParser.java │ │ │ ├── ConditionVariable.java │ │ │ ├── EGLSurfaceTexture.java │ │ │ ├── ErrorMessageProvider.java │ │ │ ├── EventDispatcher.java │ │ │ ├── EventLogger.java │ │ │ ├── FlacStreamMetadata.java │ │ │ ├── GlUtil.java │ │ │ ├── HandlerWrapper.java │ │ │ ├── LibraryLoader.java │ │ │ ├── Log.java │ │ │ ├── LongArray.java │ │ │ ├── MediaClock.java │ │ │ ├── MimeTypes.java │ │ │ ├── NalUnitUtil.java │ │ │ ├── NonNullApi.java │ │ │ ├── NotificationUtil.java │ │ │ ├── ParsableBitArray.java │ │ │ ├── ParsableByteArray.java │ │ │ ├── ParsableNalUnitBitArray.java │ │ │ ├── Predicate.java │ │ │ ├── PriorityTaskManager.java │ │ │ ├── RepeatModeUtil.java │ │ │ ├── ReusableBufferedOutputStream.java │ │ │ ├── SlidingPercentile.java │ │ │ ├── StandaloneMediaClock.java │ │ │ ├── SystemClock.java │ │ │ ├── SystemHandlerWrapper.java │ │ │ ├── TimedValueQueue.java │ │ │ ├── TimestampAdjuster.java │ │ │ ├── TraceUtil.java │ │ │ ├── UriUtil.java │ │ │ ├── Util.java │ │ │ ├── XmlPullParserUtil.java │ │ │ └── package-info.java │ │ └── video/ │ │ ├── AvcConfig.java │ │ ├── ColorInfo.java │ │ ├── DolbyVisionConfig.java │ │ ├── DummySurface.java │ │ ├── HevcConfig.java │ │ ├── MediaCodecVideoRenderer.java │ │ ├── SimpleDecoderVideoRenderer.java │ │ ├── VideoDecoderException.java │ │ ├── VideoDecoderGLSurfaceView.java │ │ ├── VideoDecoderInputBuffer.java │ │ ├── VideoDecoderOutputBuffer.java │ │ ├── VideoDecoderOutputBufferRenderer.java │ │ ├── VideoDecoderRenderer.java │ │ ├── VideoFrameMetadataListener.java │ │ ├── VideoFrameReleaseTimeHelper.java │ │ ├── VideoListener.java │ │ ├── VideoRendererEventListener.java │ │ ├── package-info.java │ │ └── spherical/ │ │ ├── CameraMotionListener.java │ │ ├── CameraMotionRenderer.java │ │ ├── FrameRotationQueue.java │ │ ├── Projection.java │ │ ├── ProjectionDecoder.java │ │ └── package-info.java │ └── res/ │ └── values/ │ └── strings.xml ├── gradle/ │ └── wrapper/ │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gradlew ├── gradlew.bat ├── ijkplayer/ │ ├── .gitignore │ ├── build.gradle │ ├── ijkplayer.iml │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── tv/ │ │ └── danmaku/ │ │ └── ijk/ │ │ └── media/ │ │ └── player/ │ │ ├── AbstractMediaPlayer.java │ │ ├── AndroidMediaPlayer.java │ │ ├── IMediaPlayer.java │ │ ├── ISurfaceTextureHolder.java │ │ ├── ISurfaceTextureHost.java │ │ ├── IjkLibLoader.java │ │ ├── IjkMediaCodecInfo.java │ │ ├── IjkMediaMeta.java │ │ ├── IjkMediaPlayer.java │ │ ├── IjkTimedText.java │ │ ├── MediaInfo.java │ │ ├── MediaPlayerProxy.java │ │ ├── TextureMediaPlayer.java │ │ ├── annotations/ │ │ │ ├── AccessedByNative.java │ │ │ └── CalledByNative.java │ │ ├── exceptions/ │ │ │ └── IjkMediaException.java │ │ ├── ffmpeg/ │ │ │ └── FFmpegApi.java │ │ ├── misc/ │ │ │ ├── AndroidMediaFormat.java │ │ │ ├── AndroidTrackInfo.java │ │ │ ├── IAndroidIO.java │ │ │ ├── IMediaDataSource.java │ │ │ ├── IMediaFormat.java │ │ │ ├── ITrackInfo.java │ │ │ ├── IjkMediaFormat.java │ │ │ └── IjkTrackInfo.java │ │ └── pragma/ │ │ ├── DebugLog.java │ │ └── Pragma.java │ └── res/ │ └── values/ │ └── strings.xml ├── mediaproxy/ │ ├── .gitignore │ ├── build.gradle │ ├── mediaproxy.iml │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── media/ │ │ └── cache/ │ │ ├── CacheManager.java │ │ ├── DownloadConstants.java │ │ ├── LocalProxyConfig.java │ │ ├── StorageManager.java │ │ ├── VideoCacheException.java │ │ ├── VideoDownloadManager.java │ │ ├── VideoDownloadQueue.java │ │ ├── VideoInfoParserManager.java │ │ ├── download/ │ │ │ ├── BaseVideoDownloadTask.java │ │ │ ├── M3U8VideoDownloadTask.java │ │ │ └── VideoDownloadTask.java │ │ ├── hls/ │ │ │ ├── M3U8.java │ │ │ ├── M3U8Constants.java │ │ │ ├── M3U8Ts.java │ │ │ └── M3U8Utils.java │ │ ├── http/ │ │ │ ├── ChunkedOutputStream.java │ │ │ ├── ContentType.java │ │ │ ├── HttpRequest.java │ │ │ ├── HttpResponse.java │ │ │ ├── IState.java │ │ │ ├── Method.java │ │ │ ├── ResponseState.java │ │ │ └── SocketProcessorTask.java │ │ ├── listener/ │ │ │ ├── IDownloadInfosCallback.java │ │ │ ├── IDownloadListener.java │ │ │ ├── IDownloadTaskListener.java │ │ │ ├── IVideoInfoCallback.java │ │ │ └── IVideoInfoParseCallback.java │ │ ├── model/ │ │ │ ├── Video.java │ │ │ ├── VideoCacheInfo.java │ │ │ ├── VideoTaskItem.java │ │ │ ├── VideoTaskMode.java │ │ │ └── VideoTaskState.java │ │ ├── proxy/ │ │ │ ├── AsyncProxyServer.java │ │ │ └── CustomProxyServer.java │ │ └── utils/ │ │ ├── DownloadExceptionUtils.java │ │ ├── HttpUtils.java │ │ ├── LocalProxyThreadUtils.java │ │ ├── LocalProxyUtils.java │ │ └── StorageUtils.java │ └── res/ │ └── values/ │ └── strings.xml ├── playersdk/ │ ├── .gitignore │ ├── build.gradle │ ├── playersdk.iml │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── android/ │ │ └── player/ │ │ ├── CommonPlayer.java │ │ ├── IPlayer.java │ │ ├── PlayerAttributes.java │ │ ├── PlayerType.java │ │ ├── impl/ │ │ │ ├── ExoPlayerImpl.java │ │ │ ├── IjkPlayerImpl.java │ │ │ ├── MediaPlayerImpl.java │ │ │ └── PlayerImpl.java │ │ └── proxy/ │ │ └── LocalProxyPlayerImpl.java │ └── res/ │ └── values/ │ └── strings.xml └── settings.gradle
Showing preview only (981K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (11816 symbols across 834 files)
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncDatagramSocket.java
class AsyncDatagramSocket (line 7) | public class AsyncDatagramSocket extends AsyncNetworkSocket {
method disconnect (line 8) | public void disconnect() throws IOException {
method getRemoteAddress (line 13) | @Override
method connect (line 20) | public void connect(InetSocketAddress address) throws IOException {
method send (line 25) | public void send(final String host, final int port, final ByteBuffer b...
method send (line 46) | public void send(final InetSocketAddress address, final ByteBuffer buf...
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncNetworkSocket.java
class AsyncNetworkSocket (line 20) | public class AsyncNetworkSocket implements AsyncSocket {
method AsyncNetworkSocket (line 21) | AsyncNetworkSocket() {
method end (line 24) | @Override
method isChunked (line 29) | public boolean isChunked() {
method attach (line 34) | void attach(SocketChannel channel, InetSocketAddress socketAddress) th...
method attach (line 40) | void attach(DatagramChannel channel) throws IOException {
method getChannel (line 47) | ChannelWrapper getChannel() {
method onDataWritable (line 51) | public void onDataWritable() {
method setup (line 65) | void setup(AsyncServer server, SelectionKey key) {
method write (line 70) | @Override
method handleRemaining (line 101) | private void handleRemaining(int remaining) throws IOException {
method onReadable (line 120) | int onReadable() {
method reportClose (line 178) | protected void reportClose(Exception e) {
method close (line 188) | @Override
method closeInternal (line 194) | private void closeInternal() {
method setWriteableCallback (line 204) | @Override
method setDataCallback (line 210) | @Override
method getDataCallback (line 215) | @Override
method setClosedCallback (line 221) | @Override
method getClosedCallback (line 226) | @Override
method getWriteableCallback (line 231) | @Override
method reportEnd (line 236) | void reportEnd(Exception e) {
method reportEndPending (line 248) | void reportEndPending(Exception e) {
method setEndCallback (line 257) | @Override
method getEndCallback (line 262) | @Override
method isOpen (line 267) | @Override
method pause (line 273) | @Override
method spitPending (line 296) | private void spitPending() {
method resume (line 302) | @Override
method isPaused (line 327) | @Override
method getServer (line 332) | @Override
method getRemoteAddress (line 338) | public InetSocketAddress getRemoteAddress() {
method getLocalAddress (line 342) | public InetAddress getLocalAddress() {
method getLocalPort (line 346) | public int getLocalPort() {
method getSocket (line 350) | public Object getSocket() {
method charset (line 354) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncSSLException.java
class AsyncSSLException (line 3) | public class AsyncSSLException extends Exception {
method AsyncSSLException (line 4) | public AsyncSSLException(Throwable cause) {
method setIgnore (line 8) | public void setIgnore(boolean ignore) {
method getIgnore (line 12) | public boolean getIgnore() {
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncSSLServerSocket.java
type AsyncSSLServerSocket (line 6) | public interface AsyncSSLServerSocket extends AsyncServerSocket {
method getPrivateKey (line 7) | PrivateKey getPrivateKey();
method getCertificate (line 8) | Certificate getCertificate();
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncSSLSocket.java
type AsyncSSLSocket (line 7) | public interface AsyncSSLSocket extends AsyncSocket {
method getPeerCertificates (line 8) | X509Certificate[] getPeerCertificates();
method getSSLEngine (line 9) | SSLEngine getSSLEngine();
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncSSLSocketWrapper.java
class AsyncSSLSocketWrapper (line 62) | public class AsyncSSLSocketWrapper implements AsyncSocketWrapper, AsyncS...
type HandshakeCallback (line 65) | public interface HandshakeCallback {
method onHandshakeCompleted (line 66) | public void onHandshakeCompleted(Exception e, AsyncSSLSocket socket);
method getAcceptedIssuers (line 106) | public java.security.cert.X509Certificate[] getAcceptedIssuers() {
method checkClientTrusted (line 110) | public void checkClientTrusted(java.security.cert.X509Certificate[] ce...
method checkServerTrusted (line 113) | public void checkServerTrusted(java.security.cert.X509Certificate[] ce...
method getAcceptedIssuers (line 132) | public java.security.cert.X509Certificate[] getAcceptedIssuers() {
method checkClientTrusted (line 136) | public void checkClientTrusted(java.security.cert.X509Certificate[] ce...
method checkServerTrusted (line 139) | public void checkServerTrusted(java.security.cert.X509Certificate[] ce...
method getDefaultSSLContext (line 150) | public static SSLContext getDefaultSSLContext() {
method handshake (line 154) | public static void handshake(AsyncSocket socket,
method connectSocket (line 178) | public static Cancellable connectSocket(AsyncServer server, String hos...
method connectSocket (line 181) | public static Cancellable connectSocket(AsyncServer server, String hos...
method AsyncSSLSocketWrapper (line 216) | private AsyncSSLSocketWrapper(AsyncSocket socket,
method onDataAvailable (line 260) | @Override
method onDataAvailable (line 324) | public void onDataAvailable() {
method getSSLEngine (line 332) | @Override
method addToPending (line 337) | void addToPending(ByteBufferList out, ByteBuffer mReadTmp) {
method end (line 348) | @Override
method getHost (line 353) | public String getHost() {
method getPort (line 357) | public int getPort() {
method handleHandshakeStatus (line 361) | private void handleHandshakeStatus(HandshakeStatus status) {
method calculateAlloc (line 432) | int calculateAlloc(int remaining) {
method write (line 441) | @Override
method setWriteableCallback (line 487) | @Override
method getWriteableCallback (line 492) | @Override
method report (line 497) | private void report(Exception e) {
method setDataCallback (line 515) | @Override
method getDataCallback (line 520) | @Override
method isChunked (line 525) | @Override
method isOpen (line 530) | @Override
method close (line 535) | @Override
method setClosedCallback (line 540) | @Override
method getClosedCallback (line 545) | @Override
method setEndCallback (line 551) | @Override
method getEndCallback (line 556) | @Override
method pause (line 561) | @Override
method resume (line 566) | @Override
method isPaused (line 572) | @Override
method getServer (line 577) | @Override
method getSocket (line 582) | @Override
method getDataEmitter (line 587) | @Override
method getPeerCertificates (line 592) | @Override
method charset (line 597) | @Override
method selfSign (line 602) | private static Certificate selfSign(KeyPair keyPair, String subjectDN)...
method selfSignCertificate (line 637) | public static Pair<KeyPair, Certificate> selfSignCertificate(final Con...
method listenSecure (line 671) | public static AsyncSSLServerSocket listenSecure(final Context context,...
method listenSecure (line 688) | public static AsyncSSLServerSocket listenSecure(AsyncServer server, St...
class ObjectHolder (line 692) | private static class ObjectHolder<T> {
method listenSecure (line 696) | public static AsyncSSLServerSocket listenSecure(final AsyncServer serv...
method listenSecure (line 714) | public static AsyncSSLServerSocket listenSecure(final AsyncServer serv...
method listenSecure (line 762) | public static AsyncServerSocket listenSecure(AsyncServer server, final...
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncSemaphore.java
class AsyncSemaphore (line 6) | public class AsyncSemaphore {
method acquire (line 10) | public void acquire() throws InterruptedException {
method tryAcquire (line 40) | public boolean tryAcquire(long timeout, TimeUnit timeunit) throws Inte...
method release (line 76) | public void release() {
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncServer.java
class AsyncServer (line 46) | public class AsyncServer {
class RunnableWrapper (line 49) | private static class RunnableWrapper implements Runnable {
method run (line 54) | @Override
method post (line 75) | public static void post(Handler handler, Runnable runnable) {
method getDefault (line 102) | public static AsyncServer getDefault() {
method isRunning (line 108) | public boolean isRunning() {
method AsyncServer (line 113) | public AsyncServer() {
method AsyncServer (line 117) | public AsyncServer(String name) {
method wakeup (line 124) | private static void wakeup(final SelectorWrapper selector) {
method kill (line 135) | public void kill() {
method postDelayed (line 143) | public Cancellable postDelayed(Runnable runnable, long delay) {
method postImmediate (line 177) | public Cancellable postImmediate(Runnable runnable) {
method post (line 185) | public Cancellable post(Runnable runnable) {
method post (line 189) | public Cancellable post(final CompletedCallback callback, final Except...
method run (line 193) | public void run(final Runnable runnable) {
class Scheduled (line 218) | private static class Scheduled implements Cancellable, Runnable {
method Scheduled (line 221) | public Scheduled(AsyncServer server, Runnable runnable, long time) {
method run (line 230) | @Override
method isDone (line 235) | @Override
method isCancelled (line 243) | @Override
method cancel (line 248) | @Override
class Scheduler (line 257) | static class Scheduler implements Comparator<Scheduled> {
method Scheduler (line 259) | private Scheduler() {
method compare (line 261) | @Override
method stop (line 273) | public void stop() {
method stop (line 277) | public void stop(boolean wait) {
method onDataReceived (line 320) | protected void onDataReceived(int transmitted) {
method onDataSent (line 323) | protected void onDataSent(int transmitted) {
class ObjectHolder (line 326) | private static class ObjectHolder<T> {
method listen (line 329) | public AsyncServerSocket listen(final InetAddress host, final int port...
class ConnectFuture (line 377) | private class ConnectFuture extends SimpleFuture<AsyncNetworkSocket> {
method cancelCleanup (line 378) | @Override
method connectResolvedInetSocketAddress (line 393) | public Cancellable connectResolvedInetSocketAddress(final InetSocketAd...
method connectResolvedInetSocketAddress (line 397) | public ConnectFuture connectResolvedInetSocketAddress(final InetSocket...
method connectSocket (line 431) | public Cancellable connectSocket(final InetSocketAddress remote, final...
method connectSocket (line 455) | public Cancellable connectSocket(final String host, final int port, fi...
method newSynchronousWorkers (line 459) | private static ExecutorService newSynchronousWorkers(String prefix) {
method compare (line 467) | @Override
method getAllByName (line 480) | public Future<InetAddress[]> getAllByName(final String host) {
method getByName (line 509) | public Future<InetAddress> getByName(String host) {
method handleSocket (line 513) | private void handleSocket(final AsyncNetworkSocket handler) throws Clo...
method connectDatagram (line 520) | public AsyncDatagramSocket connectDatagram(final String host, final in...
method openDatagram (line 544) | public AsyncDatagramSocket openDatagram() {
method createDatagram (line 548) | public Cancellable createDatagram(String address, int port, boolean re...
method createDatagram (line 552) | public Cancellable createDatagram(InetAddress address, int port, boole...
method createDatagram (line 556) | private Cancellable createDatagram(ValueFunction<InetAddress> inetAddr...
method openDatagram (line 589) | public AsyncDatagramSocket openDatagram(final InetAddress host, final ...
method connectDatagram (line 631) | public AsyncDatagramSocket connectDatagram(final SocketAddress remote)...
method getCurrentThreadServer (line 659) | public static AsyncServer getCurrentThreadServer() {
method run (line 664) | private void run() {
method run (line 716) | private static void run(final AsyncServer server, final SelectorWrappe...
method shutdownKeys (line 751) | private static void shutdownKeys(SelectorWrapper selector) {
method shutdownEverything (line 766) | private static void shutdownEverything(SelectorWrapper selector) {
method lockAndRunQueue (line 773) | private static long lockAndRunQueue(final AsyncServer server, final Pr...
class AsyncSelectorException (line 805) | private static class AsyncSelectorException extends IOException {
method AsyncSelectorException (line 806) | public AsyncSelectorException(Exception e) {
method runLoop (line 811) | private static void runLoop(final AsyncServer server, final SelectorWr...
method dump (line 919) | public void dump() {
method getAffinity (line 936) | public Thread getAffinity() {
method isAffinityThread (line 940) | public boolean isAffinityThread() {
method isAffinityThreadOrStopped (line 944) | public boolean isAffinityThreadOrStopped() {
class NamedThreadFactory (line 949) | private static class NamedThreadFactory implements ThreadFactory {
method NamedThreadFactory (line 954) | NamedThreadFactory(String namePrefix) {
method newThread (line 961) | public Thread newThread(Runnable r) {
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncServerSocket.java
type AsyncServerSocket (line 3) | public interface AsyncServerSocket {
method stop (line 4) | void stop();
method getLocalPort (line 5) | int getLocalPort();
FILE: androidasync/src/main/java/com/jeffmony/async/AsyncSocket.java
type AsyncSocket (line 3) | public interface AsyncSocket extends DataEmitter, DataSink {
method getServer (line 4) | AsyncServer getServer();
FILE: androidasync/src/main/java/com/jeffmony/async/BufferedDataSink.java
class BufferedDataSink (line 6) | public class BufferedDataSink implements DataSink {
method BufferedDataSink (line 8) | public BufferedDataSink(DataSink datasink) {
method isBuffering (line 12) | public boolean isBuffering() {
method isWritable (line 16) | public boolean isWritable() {
method getDataSink (line 22) | public DataSink getDataSink() {
method forceBuffering (line 27) | public void forceBuffering(boolean forceBuffering) {
method setDataSink (line 33) | public void setDataSink(DataSink datasink) {
method writePending (line 38) | private void writePending() {
method onDataAccepted (line 60) | protected void onDataAccepted(ByteBufferList bb) {
method write (line 63) | @Override
method setWriteableCallback (line 87) | @Override
method getWriteableCallback (line 92) | @Override
method remaining (line 97) | public int remaining() {
method getMaxBuffer (line 102) | public int getMaxBuffer() {
method setMaxBuffer (line 106) | public void setMaxBuffer(int maxBuffer) {
method isOpen (line 111) | @Override
method end (line 117) | @Override
method setClosedCallback (line 133) | @Override
method getClosedCallback (line 138) | @Override
method getServer (line 143) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/ByteBufferList.java
class ByteBufferList (line 18) | @TargetApi(Build.VERSION_CODES.GINGERBREAD)
method order (line 23) | public ByteOrder order() {
method order (line 27) | public ByteBufferList order(ByteOrder order) {
method ByteBufferList (line 32) | public ByteBufferList() {
method ByteBufferList (line 35) | public ByteBufferList(ByteBuffer... b) {
method ByteBufferList (line 39) | public ByteBufferList(byte[] buf) {
method addAll (line 45) | public ByteBufferList addAll(ByteBuffer... bb) {
method addAll (line 51) | public ByteBufferList addAll(ByteBufferList... bb) {
method getBytes (line 57) | public byte[] getBytes(int length) {
method getAllByteArray (line 63) | public byte[] getAllByteArray() {
method getAllArray (line 69) | public ByteBuffer[] getAllArray() {
method isEmpty (line 77) | public boolean isEmpty() {
method remaining (line 82) | public int remaining() {
method hasRemaining (line 86) | public boolean hasRemaining() {
method peekShort (line 90) | public short peekShort() {
method peek (line 94) | public byte peek() {
method peekInt (line 98) | public int peekInt() {
method peekLong (line 102) | public long peekLong() {
method peekBytes (line 106) | public byte[] peekBytes(int size) {
method skip (line 112) | public ByteBufferList skip(int length) {
method getInt (line 117) | public int getInt() {
method getByteChar (line 123) | public char getByteChar() {
method getShort (line 129) | public short getShort() {
method get (line 135) | public byte get() {
method getLong (line 141) | public long getLong() {
method get (line 147) | public void get(byte[] bytes) {
method get (line 151) | public void get(byte[] bytes, int offset, int length) {
method get (line 177) | public void get(ByteBufferList into, int length) {
method get (line 214) | public void get(ByteBufferList into) {
method get (line 218) | public ByteBufferList get(int length) {
method getAll (line 224) | public ByteBuffer getAll() {
method read (line 231) | private ByteBuffer read(int count) {
method trim (line 272) | public void trim() {
method add (line 277) | public ByteBufferList add(ByteBufferList b) {
method add (line 282) | public ByteBufferList add(ByteBuffer b) {
method addFirst (line 310) | public void addFirst(ByteBuffer b) {
method addRemaining (line 332) | private void addRemaining(int remaining) {
method recycle (line 337) | public void recycle() {
method remove (line 345) | public ByteBuffer remove() {
method size (line 351) | public int size() {
method spewString (line 355) | public void spewString() {
method peekString (line 359) | public String peekString() {
method peekString (line 364) | public String peekString(Charset charset) {
method readString (line 388) | public String readString() {
method readString (line 392) | public String readString(Charset charset) {
class Reclaimer (line 398) | static class Reclaimer implements Comparator<ByteBuffer> {
method compare (line 399) | @Override
method getReclaimed (line 412) | private static PriorityQueue<ByteBuffer> getReclaimed() {
method setMaxPoolSize (line 426) | public static void setMaxPoolSize(int size) {
method setMaxItemSize (line 430) | public static void setMaxItemSize(int size) {
method reclaimedContains (line 434) | private static boolean reclaimedContains(ByteBuffer b) {
method reclaim (line 442) | public static void reclaim(ByteBuffer b) {
method obtain (line 483) | public static ByteBuffer obtain(int size) {
method obtainArray (line 509) | public static void obtainArray(ByteBuffer[] arr, int size) {
method deepCopy (line 537) | public static ByteBuffer deepCopy(ByteBuffer copyOf) {
method writeOutputStream (line 545) | public static void writeOutputStream(OutputStream out, ByteBuffer b) t...
FILE: androidasync/src/main/java/com/jeffmony/async/ChannelWrapper.java
class ChannelWrapper (line 13) | abstract class ChannelWrapper implements ReadableByteChannel, Scattering...
method ChannelWrapper (line 15) | ChannelWrapper(AbstractSelectableChannel channel) throws IOException {
method shutdownInput (line 20) | public abstract void shutdownInput();
method shutdownOutput (line 21) | public abstract void shutdownOutput();
method isConnected (line 23) | public abstract boolean isConnected();
method write (line 25) | public abstract int write(ByteBuffer src) throws IOException;
method write (line 26) | public abstract int write(ByteBuffer[] src) throws IOException;
method register (line 29) | public abstract SelectionKey register(Selector sel) throws ClosedChann...
method register (line 31) | public SelectionKey register(Selector sel, int ops) throws ClosedChann...
method isChunked (line 35) | public boolean isChunked() {
method isOpen (line 39) | @Override
method close (line 44) | @Override
method getLocalPort (line 49) | public abstract int getLocalPort();
method getLocalAddress (line 50) | public abstract InetAddress getLocalAddress();
method getSocket (line 51) | public abstract Object getSocket();
FILE: androidasync/src/main/java/com/jeffmony/async/DataEmitter.java
type DataEmitter (line 6) | public interface DataEmitter {
method setDataCallback (line 7) | void setDataCallback(DataCallback callback);
method getDataCallback (line 8) | DataCallback getDataCallback();
method isChunked (line 9) | boolean isChunked();
method pause (line 10) | void pause();
method resume (line 11) | void resume();
method close (line 12) | void close();
method isPaused (line 13) | boolean isPaused();
method setEndCallback (line 14) | void setEndCallback(CompletedCallback callback);
method getEndCallback (line 15) | CompletedCallback getEndCallback();
method getServer (line 16) | AsyncServer getServer();
method charset (line 17) | String charset();
FILE: androidasync/src/main/java/com/jeffmony/async/DataEmitterBase.java
class DataEmitterBase (line 9) | public abstract class DataEmitterBase implements DataEmitter {
method report (line 11) | protected void report(Exception e) {
method setEndCallback (line 19) | @Override
method getEndCallback (line 25) | @Override
method setDataCallback (line 32) | @Override
method getDataCallback (line 37) | @Override
method charset (line 42) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/DataEmitterReader.java
class DataEmitterReader (line 5) | public class DataEmitterReader implements DataCallback {
method read (line 10) | public void read(int count, DataCallback callback) {
method handlePendingData (line 18) | private boolean handlePendingData(DataEmitter emitter) {
method DataEmitterReader (line 30) | public DataEmitterReader() {
method onDataAvailable (line 32) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/DataSink.java
type DataSink (line 6) | public interface DataSink {
method write (line 7) | public void write(ByteBufferList bb);
method setWriteableCallback (line 8) | public void setWriteableCallback(WritableCallback handler);
method getWriteableCallback (line 9) | public WritableCallback getWriteableCallback();
method isOpen (line 11) | public boolean isOpen();
method end (line 12) | public void end();
method setClosedCallback (line 13) | public void setClosedCallback(CompletedCallback handler);
method getClosedCallback (line 14) | public CompletedCallback getClosedCallback();
method getServer (line 15) | public AsyncServer getServer();
FILE: androidasync/src/main/java/com/jeffmony/async/DataTrackingEmitter.java
type DataTrackingEmitter (line 6) | public interface DataTrackingEmitter extends DataEmitter {
type DataTracker (line 7) | interface DataTracker {
method onData (line 8) | void onData(int totalBytesRead);
method setDataTracker (line 10) | void setDataTracker(DataTracker tracker);
method getDataTracker (line 11) | DataTracker getDataTracker();
method getBytesRead (line 12) | int getBytesRead();
method setDataEmitter (line 13) | void setDataEmitter(DataEmitter emitter);
FILE: androidasync/src/main/java/com/jeffmony/async/DatagramChannelWrapper.java
class DatagramChannelWrapper (line 12) | class DatagramChannelWrapper extends ChannelWrapper {
method getLocalAddress (line 15) | @Override
method getLocalPort (line 20) | @Override
method getRemoteAddress (line 26) | public InetSocketAddress getRemoteAddress() {
method disconnect (line 30) | public void disconnect() throws IOException {
method DatagramChannelWrapper (line 34) | DatagramChannelWrapper(DatagramChannel channel) throws IOException {
method read (line 38) | @Override
method isConnected (line 50) | @Override
method write (line 54) | @Override
method write (line 58) | @Override
method register (line 62) | @Override
method isChunked (line 66) | @Override
method register (line 70) | @Override
method shutdownOutput (line 75) | @Override
method shutdownInput (line 79) | @Override
method read (line 83) | @Override
method read (line 88) | @Override
method getSocket (line 93) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/FileDataEmitter.java
class FileDataEmitter (line 14) | public class FileDataEmitter extends DataEmitterBase {
method FileDataEmitter (line 17) | public FileDataEmitter(AsyncServer server, File file) {
method setDataCallback (line 26) | @Override
method getDataCallback (line 31) | @Override
method isChunked (line 36) | @Override
method pause (line 42) | @Override
method resume (line 47) | @Override
method report (line 53) | @Override
method run (line 62) | @Override
method doResume (line 91) | private void doResume() {
method isPaused (line 95) | @Override
method getServer (line 100) | @Override
method close (line 105) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/FilteredDataEmitter.java
class FilteredDataEmitter (line 7) | public class FilteredDataEmitter extends DataEmitterBase implements Data...
method getDataEmitter (line 9) | @Override
method setDataEmitter (line 14) | @Override
method getBytesRead (line 29) | @Override
method getDataTracker (line 34) | @Override
method setDataTracker (line 39) | @Override
method onDataAvailable (line 46) | @Override
method isChunked (line 65) | @Override
method pause (line 70) | @Override
method resume (line 75) | @Override
method isPaused (line 80) | @Override
method getServer (line 85) | @Override
method close (line 91) | @Override
method charset (line 98) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/FilteredDataSink.java
class FilteredDataSink (line 3) | public class FilteredDataSink extends BufferedDataSink {
method FilteredDataSink (line 4) | public FilteredDataSink(DataSink sink) {
method filter (line 9) | public ByteBufferList filter(ByteBufferList bb) {
method onDataAccepted (line 13) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/HostnameResolutionException.java
class HostnameResolutionException (line 3) | public class HostnameResolutionException extends Exception {
method HostnameResolutionException (line 4) | public HostnameResolutionException(String message) {
FILE: androidasync/src/main/java/com/jeffmony/async/LineEmitter.java
class LineEmitter (line 8) | public class LineEmitter implements DataCallback {
type StringCallback (line 9) | public interface StringCallback {
method onStringAvailable (line 10) | void onStringAvailable(String s);
method LineEmitter (line 13) | public LineEmitter() {
method LineEmitter (line 17) | public LineEmitter(Charset charset) {
method setLineCallback (line 26) | public void setLineCallback(StringCallback callback) {
method getLineCallback (line 30) | public StringCallback getLineCallback() {
method onDataAvailable (line 34) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/PushParser.java
class PushParser (line 14) | public class PushParser implements DataCallback {
type ParseCallback (line 16) | public interface ParseCallback<T> {
method parsed (line 17) | public void parsed(T data);
class Waiter (line 20) | static abstract class Waiter {
method Waiter (line 22) | public Waiter(int length) {
method onDataAvailable (line 30) | public abstract Waiter onDataAvailable(DataEmitter emitter, ByteBuff...
class IntWaiter (line 33) | static class IntWaiter extends Waiter {
method IntWaiter (line 35) | public IntWaiter(ParseCallback<Integer> callback) {
method onDataAvailable (line 40) | @Override
class ByteArrayWaiter (line 47) | static class ByteArrayWaiter extends Waiter {
method ByteArrayWaiter (line 49) | public ByteArrayWaiter(int length, ParseCallback<byte[]> callback) {
method onDataAvailable (line 56) | @Override
class LenByteArrayWaiter (line 65) | static class LenByteArrayWaiter extends Waiter {
method LenByteArrayWaiter (line 68) | public LenByteArrayWaiter(ParseCallback<byte[]> callback) {
method onDataAvailable (line 73) | @Override
class ByteBufferListWaiter (line 85) | static class ByteBufferListWaiter extends Waiter {
method ByteBufferListWaiter (line 87) | public ByteBufferListWaiter(int length, ParseCallback<ByteBufferList...
method onDataAvailable (line 93) | @Override
class LenByteBufferListWaiter (line 100) | static class LenByteBufferListWaiter extends Waiter {
method LenByteBufferListWaiter (line 103) | public LenByteBufferListWaiter(ParseCallback<ByteBufferList> callbac...
method onDataAvailable (line 108) | @Override
class UntilWaiter (line 115) | static class UntilWaiter extends Waiter {
method UntilWaiter (line 119) | public UntilWaiter(byte value, DataCallback callback) {
method onDataAvailable (line 125) | @Override
class TapWaiter (line 158) | private class TapWaiter extends Waiter {
method TapWaiter (line 161) | public TapWaiter(TapCallback callback) {
method onDataAvailable (line 166) | @Override
method onDataAvailable (line 181) | @Override
method onDataAvailable (line 189) | @Override
method onDataAvailable (line 197) | @Override
method onDataAvailable (line 205) | @Override
method onDataAvailable (line 213) | @Override
method parsed (line 221) | @Override
method parsed (line 228) | @Override
method parsed (line 235) | @Override
method setOrder (line 246) | public PushParser setOrder(ByteOrder order) {
method PushParser (line 251) | public PushParser(DataEmitter s) {
method readInt (line 256) | public PushParser readInt(ParseCallback<Integer> callback) {
method readByteArray (line 261) | public PushParser readByteArray(int length, ParseCallback<byte[]> call...
method readByteBufferList (line 266) | public PushParser readByteBufferList(int length, ParseCallback<ByteBuf...
method until (line 271) | public PushParser until(byte b, DataCallback callback) {
method readByte (line 276) | public PushParser readByte() {
method readShort (line 281) | public PushParser readShort() {
method readInt (line 286) | public PushParser readInt() {
method readLong (line 291) | public PushParser readLong() {
method readByteArray (line 296) | public PushParser readByteArray(int length) {
method readLenByteArray (line 300) | public PushParser readLenByteArray() {
method readByteBufferList (line 305) | public PushParser readByteBufferList(int length) {
method readLenByteBufferList (line 309) | public PushParser readLenByteBufferList() {
method readLenByteBufferList (line 313) | public PushParser readLenByteBufferList(ParseCallback<ByteBufferList> ...
method readString (line 318) | public PushParser readString() {
method noop (line 323) | public PushParser noop() {
method onDataAvailable (line 329) | @Override
method tap (line 341) | public void tap(TapCallback callback) {
method getTap (line 346) | static Method getTap(TapCallback callback) {
FILE: androidasync/src/main/java/com/jeffmony/async/SelectorWrapper.java
class SelectorWrapper (line 15) | class SelectorWrapper implements Closeable {
method getSelector (line 19) | public Selector getSelector() {
method SelectorWrapper (line 23) | public SelectorWrapper(Selector selector) {
method selectNow (line 27) | public int selectNow() throws IOException {
method select (line 31) | public void select() throws IOException {
method select (line 35) | public void select(long timeout) throws IOException {
method keys (line 45) | public Set<SelectionKey> keys() {
method selectedKeys (line 49) | public Set<SelectionKey> selectedKeys() {
method close (line 53) | @Override
method isOpen (line 58) | public boolean isOpen() {
method wakeupOnce (line 62) | public void wakeupOnce() {
method waitForSelect (line 84) | public boolean waitForSelect() {
FILE: androidasync/src/main/java/com/jeffmony/async/ServerSocketChannelWrapper.java
class ServerSocketChannelWrapper (line 11) | class ServerSocketChannelWrapper extends ChannelWrapper {
method shutdownOutput (line 14) | @Override
method shutdownInput (line 18) | @Override
method getLocalAddress (line 22) | @Override
method getLocalPort (line 27) | @Override
method ServerSocketChannelWrapper (line 32) | ServerSocketChannelWrapper(ServerSocketChannel channel) throws IOExcep...
method read (line 37) | @Override
method isConnected (line 44) | @Override
method write (line 50) | @Override
method register (line 57) | @Override
method write (line 62) | @Override
method read (line 69) | @Override
method read (line 76) | @Override
method getSocket (line 83) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/SocketChannelWrapper.java
class SocketChannelWrapper (line 11) | class SocketChannelWrapper extends ChannelWrapper {
method getLocalAddress (line 14) | @Override
method getLocalPort (line 19) | @Override
method SocketChannelWrapper (line 24) | SocketChannelWrapper(SocketChannel channel) throws IOException {
method read (line 28) | @Override
method isConnected (line 32) | @Override
method write (line 36) | @Override
method write (line 40) | @Override
method register (line 44) | @Override
method shutdownOutput (line 49) | @Override
method shutdownInput (line 58) | @Override
method read (line 67) | @Override
method read (line 72) | @Override
method getSocket (line 77) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/TapCallback.java
type TapCallback (line 4) | public interface TapCallback {
FILE: androidasync/src/main/java/com/jeffmony/async/ThreadQueue.java
class ThreadQueue (line 7) | class ThreadQueue extends LinkedList<Runnable> {
method getOrCreateThreadQueue (line 10) | static ThreadQueue getOrCreateThreadQueue(Thread thread) {
method release (line 23) | static void release(AsyncSemaphore semaphore) {
method add (line 35) | @Override
method remove (line 42) | @Override
method remove (line 49) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/Util.java
class Util (line 17) | public class Util {
method emitAllData (line 19) | public static void emitAllData(DataEmitter emitter, ByteBufferList lis...
method pump (line 58) | public static void pump(final InputStream is, final DataSink ds, final...
method pump (line 62) | public static void pump(final InputStream is, final long max, final Da...
method pump (line 123) | public static void pump(final DataEmitter emitter, final DataSink sink...
method stream (line 166) | public static void stream(AsyncSocket s1, AsyncSocket s2, CompletedCal...
method pump (line 171) | public static void pump(final File file, final DataSink ds, final Comp...
method writeAll (line 196) | public static void writeAll(final DataSink sink, final ByteBufferList ...
method writeAll (line 210) | public static void writeAll(DataSink sink, byte[] bytes, CompletedCall...
method getWrappedSocket (line 219) | public static <T extends AsyncSocket> T getWrappedSocket(AsyncSocket s...
method getWrappedDataEmitter (line 230) | public static DataEmitter getWrappedDataEmitter(DataEmitter emitter, C...
method end (line 241) | public static void end(DataEmitter emitter, Exception e) {
method end (line 247) | public static void end(CompletedCallback end, Exception e) {
method writable (line 252) | public static void writable(DataSink emitter) {
method writable (line 258) | public static void writable(WritableCallback writable) {
FILE: androidasync/src/main/java/com/jeffmony/async/ZipDataSink.java
class ZipDataSink (line 11) | public class ZipDataSink extends FilteredDataSink {
method ZipDataSink (line 12) | public ZipDataSink(DataSink sink) {
method putNextEntry (line 19) | public void putNextEntry(ZipEntry ze) throws IOException {
method closeEntry (line 23) | public void closeEntry() throws IOException {
method report (line 27) | protected void report(Exception e) {
method end (line 33) | @Override
method filter (line 47) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/callback/CompletedCallback.java
type CompletedCallback (line 3) | public interface CompletedCallback {
class NullCompletedCallback (line 4) | class NullCompletedCallback implements CompletedCallback {
method onCompleted (line 5) | @Override
method onCompleted (line 11) | public void onCompleted(Exception ex);
FILE: androidasync/src/main/java/com/jeffmony/async/callback/ConnectCallback.java
type ConnectCallback (line 5) | public interface ConnectCallback {
method onConnectCompleted (line 6) | void onConnectCompleted(Exception ex, AsyncSocket socket);
FILE: androidasync/src/main/java/com/jeffmony/async/callback/ContinuationCallback.java
type ContinuationCallback (line 5) | public interface ContinuationCallback {
method onContinue (line 6) | void onContinue(Continuation continuation, CompletedCallback next) thr...
FILE: androidasync/src/main/java/com/jeffmony/async/callback/DataCallback.java
type DataCallback (line 6) | public interface DataCallback {
class NullDataCallback (line 7) | class NullDataCallback implements DataCallback {
method onDataAvailable (line 8) | @Override
method onDataAvailable (line 14) | void onDataAvailable(DataEmitter emitter, ByteBufferList bb);
FILE: androidasync/src/main/java/com/jeffmony/async/callback/ListenCallback.java
type ListenCallback (line 6) | public interface ListenCallback extends CompletedCallback {
method onAccepted (line 7) | void onAccepted(AsyncSocket socket);
method onListening (line 8) | void onListening(AsyncServerSocket socket);
FILE: androidasync/src/main/java/com/jeffmony/async/callback/ResultCallback.java
type ResultCallback (line 3) | public interface ResultCallback<S, T> {
method onCompleted (line 4) | public void onCompleted(Exception e, S source, T result);
FILE: androidasync/src/main/java/com/jeffmony/async/callback/SocketCreateCallback.java
type SocketCreateCallback (line 3) | public interface SocketCreateCallback {
method onSocketCreated (line 4) | void onSocketCreated(int localPort);
FILE: androidasync/src/main/java/com/jeffmony/async/callback/ValueCallback.java
type ValueCallback (line 6) | public interface ValueCallback<T> {
method onResult (line 7) | void onResult(T value);
FILE: androidasync/src/main/java/com/jeffmony/async/callback/ValueFunction.java
type ValueFunction (line 3) | public interface ValueFunction<T> {
method getValue (line 4) | T getValue() throws Exception;
FILE: androidasync/src/main/java/com/jeffmony/async/callback/WritableCallback.java
type WritableCallback (line 3) | public interface WritableCallback {
method onWriteable (line 4) | public void onWriteable();
FILE: androidasync/src/main/java/com/jeffmony/async/dns/Dns.java
class Dns (line 25) | public class Dns {
method lookup (line 26) | public static Future<DnsResponse> lookup(String host) {
method setFlag (line 30) | private static int setFlag(int flags, int value, int offset) {
method setQuery (line 34) | private static int setQuery(int flags) {
method setRecursion (line 38) | private static int setRecursion(int flags) {
method addName (line 42) | private static void addName(ByteBuffer bb, String name) {
method lookup (line 51) | public static Future<DnsResponse> lookup(AsyncServer server, String ho...
method multicastLookup (line 55) | public static Cancellable multicastLookup(AsyncServer server, String h...
method multicastLookup (line 59) | public static Cancellable multicastLookup(String host, FutureCallback<...
method lookup (line 63) | public static Future<DnsResponse> lookup(AsyncServer server, String ho...
FILE: androidasync/src/main/java/com/jeffmony/async/dns/DnsResponse.java
class DnsResponse (line 15) | public class DnsResponse {
method parseName (line 21) | private static String parseName(ByteBufferList bb, ByteBuffer backRefe...
method parse (line 49) | public static DnsResponse parse(ByteBufferList bb) {
method parseTxt (line 160) | void parseTxt(ByteBufferList bb) {
method toString (line 171) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/future/Cancellable.java
type Cancellable (line 3) | public interface Cancellable {
method isDone (line 8) | boolean isDone();
method isCancelled (line 14) | boolean isCancelled();
method cancel (line 20) | boolean cancel();
FILE: androidasync/src/main/java/com/jeffmony/async/future/Continuation.java
class Continuation (line 8) | public class Continuation extends SimpleCancellable implements Continuat...
method getCallback (line 12) | public CompletedCallback getCallback() {
method setCallback (line 15) | public void setCallback(CompletedCallback callback) {
method getCancelCallback (line 19) | public Runnable getCancelCallback() {
method setCancelCallback (line 22) | public void setCancelCallback(Runnable cancelCallback) {
method setCancelCallback (line 25) | public void setCancelCallback(final Cancellable cancel) {
method Continuation (line 38) | public Continuation() {
method Continuation (line 41) | public Continuation(CompletedCallback callback) {
method Continuation (line 44) | public Continuation(CompletedCallback callback, Runnable cancelCallbac...
method wrap (line 49) | private CompletedCallback wrap() {
method reportCompleted (line 70) | void reportCompleted(Exception ex) {
method hook (line 79) | private ContinuationCallback hook(ContinuationCallback callback) {
method add (line 87) | public Continuation add(ContinuationCallback callback) {
method insert (line 92) | public Continuation insert(ContinuationCallback callback) {
method add (line 97) | public Continuation add(final DependentFuture future) {
method next (line 111) | private void next() {
method cancel (line 138) | @Override
method start (line 150) | public Continuation start() {
method onContinue (line 158) | @Override
method run (line 164) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/future/Converter.java
class Converter (line 16) | public class Converter<R> {
method convert (line 17) | public static <T> Converter<T> convert(Future<T> future, String mime) {
method convert (line 21) | public static <T> Converter<T> convert(Future<T> future) {
class MimedData (line 25) | static class MimedData<T> {
method MimedData (line 26) | public MimedData(T data, String mime) {
class MultiTransformer (line 34) | static class MultiTransformer<T, F> extends MultiTransformFuture<Mimed...
method MultiTransformer (line 38) | public MultiTransformer(TypeConverter<T, F> converter, String conver...
method transform (line 44) | @Override
class EnsureHashMap (line 69) | static abstract class EnsureHashMap<K, V> extends LinkedHashMap<K, V> {
method ensure (line 70) | synchronized V ensure(K k) {
method makeDefault (line 77) | protected abstract V makeDefault();
class MimedType (line 80) | static class MimedType<T> {
method MimedType (line 81) | MimedType(Class<T> type, String mime) {
method hashCode (line 88) | @Override
method equals (line 93) | @Override
method isTypeOf (line 100) | public boolean isTypeOf(MimedType other) {
method primary (line 108) | public String primary() {
method secondary (line 112) | public String secondary() {
method isTypeOf (line 117) | public boolean isTypeOf(String mime) {
method toString (line 131) | @Override
class ConverterTransformers (line 137) | static class ConverterTransformers<F, T> extends LinkedHashMap<MimedTy...
class Converters (line 140) | static class Converters<F, T> extends EnsureHashMap<MimedType<F>, Conv...
method makeDefault (line 141) | @Override
method add (line 146) | private static <F, T> void add(ConverterTransformers<F, T> set, Conv...
method getAll (line 151) | public ConverterTransformers<F, T> getAll(MimedType<T> mimedType) {
method getConverters (line 165) | protected ConverterEntries getConverters() {
method Converter (line 171) | protected Converter(Future future, String mime) {
method to (line 178) | synchronized private final <T> Future<T> to(Object value, Class<T> cla...
method to (line 184) | synchronized private final <T> Future<T> to(Class fromClass, Class<T> ...
class PathInfo (line 216) | static class PathInfo {
method distance (line 221) | static int distance(ArrayDeque<PathInfo> path) {
method mimeReplace (line 230) | static String mimeReplace(String mime1, String mime2) {
method to (line 241) | public final <T> Future<T> to(Class<T> clazz) {
method search (line 245) | private <T> boolean search(MimedType<T> target, ArrayDeque<PathInfo> b...
method to (line 291) | public <T> Future<T> to(Class<T> clazz, String mime) {
class ConverterEntry (line 295) | static class ConverterEntry<F, T> {
method ConverterEntry (line 296) | ConverterEntry(Class<F> from, String fromMime, Class<T> to, String t...
method hashCode (line 307) | @Override
method equals (line 312) | @Override
class ConverterEntries (line 319) | public static class ConverterEntries {
method ConverterEntries (line 321) | public ConverterEntries() {
method ConverterEntries (line 324) | public ConverterEntries(ConverterEntries other) {
method addConverter (line 328) | public synchronized <F, T> void addConverter(Class<F> from, String f...
method addConverter (line 331) | public synchronized <F, T> void addConverter(Class<F> from, String f...
method removeConverter (line 340) | public synchronized boolean removeConverter(TypeConverter typeConver...
FILE: androidasync/src/main/java/com/jeffmony/async/future/DependentCancellable.java
type DependentCancellable (line 3) | public interface DependentCancellable extends Cancellable {
method setParent (line 4) | boolean setParent(Cancellable parent);
FILE: androidasync/src/main/java/com/jeffmony/async/future/DependentFuture.java
type DependentFuture (line 3) | public interface DependentFuture<T> extends Future<T>, DependentCancella...
FILE: androidasync/src/main/java/com/jeffmony/async/future/DoneCallback.java
type DoneCallback (line 3) | public interface DoneCallback<T> {
method done (line 4) | void done(Exception e, T result) throws Exception;
FILE: androidasync/src/main/java/com/jeffmony/async/future/FailCallback.java
type FailCallback (line 3) | public interface FailCallback {
method fail (line 10) | void fail(Exception e) throws Exception;
FILE: androidasync/src/main/java/com/jeffmony/async/future/FailConvertCallback.java
type FailConvertCallback (line 3) | public interface FailConvertCallback<T> {
method fail (line 11) | T fail(Exception e) throws Exception;
FILE: androidasync/src/main/java/com/jeffmony/async/future/FailRecoverCallback.java
type FailRecoverCallback (line 3) | public interface FailRecoverCallback<T> {
method fail (line 11) | Future<T> fail(Exception e) throws Exception;
FILE: androidasync/src/main/java/com/jeffmony/async/future/Future.java
type Future (line 9) | public interface Future<T> extends Cancellable, java.util.concurrent.Fut...
method setCallback (line 15) | void setCallback(FutureCallback<T> callback);
method done (line 25) | Future<T> done(DoneCallback<T> done);
method success (line 33) | Future<T> success(SuccessCallback<T> callback);
method then (line 42) | <R> Future<R> then(ThenFutureCallback<R, T> then);
method thenConvert (line 51) | <R> Future<R> thenConvert(ThenCallback<R, T> then);
method fail (line 60) | Future<T> fail(FailCallback fail);
method failConvert (line 69) | Future<T> failConvert(FailConvertCallback<T> fail);
method failRecover (line 78) | Future<T> failRecover(FailRecoverCallback<T> fail);
method tryGet (line 84) | T tryGet();
method tryGetException (line 90) | Exception tryGetException();
method executorThread (line 97) | @RequiresApi(api = Build.VERSION_CODES.N)
FILE: androidasync/src/main/java/com/jeffmony/async/future/FutureCallback.java
type FutureCallback (line 6) | public interface FutureCallback<T> {
method onCompleted (line 12) | void onCompleted(Exception e, T result);
FILE: androidasync/src/main/java/com/jeffmony/async/future/FutureRunnable.java
type FutureRunnable (line 6) | public interface FutureRunnable<T> {
method run (line 7) | T run() throws Exception;
FILE: androidasync/src/main/java/com/jeffmony/async/future/FutureThread.java
class FutureThread (line 8) | public class FutureThread<T> extends SimpleFuture<T> {
method FutureThread (line 9) | public FutureThread(final FutureRunnable<T> runnable) {
method FutureThread (line 13) | public FutureThread(final ExecutorService pool, final FutureRunnable<T...
method FutureThread (line 27) | public FutureThread(final FutureRunnable<T> runnable, String name) {
FILE: androidasync/src/main/java/com/jeffmony/async/future/Futures.java
class Futures (line 8) | public class Futures {
method waitAll (line 9) | public static <T> Future<List<T>> waitAll(final List<Future<T>> future...
method waitAll (line 37) | public static <T> Future<List<T>> waitAll(final Future<T>... futures) {
method loopUntil (line 42) | private static <T, F> void loopUntil(final Iterator<F> values, ThenFut...
method loopUntil (line 60) | public static <T, F> Future<T> loopUntil(final Iterable<F> values, The...
method loopUntil (line 66) | public static <T, F> Future<T> loopUntil(final F[] values, ThenFutureC...
FILE: androidasync/src/main/java/com/jeffmony/async/future/HandlerFuture.java
class HandlerFuture (line 9) | public class HandlerFuture<T> extends SimpleFuture<T> {
method HandlerFuture (line 12) | public HandlerFuture() {
method setCallback (line 19) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/future/MultiFuture.java
class MultiFuture (line 8) | public class MultiFuture<T> extends SimpleFuture<T> {
method MultiFuture (line 11) | public MultiFuture() {
method MultiFuture (line 14) | public MultiFuture(T value) {
method MultiFuture (line 18) | public MultiFuture(Exception e) {
method MultiFuture (line 22) | public MultiFuture(Future<T> future) {
method setCallbackInternal (line 40) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/future/MultiTransformFuture.java
class MultiTransformFuture (line 3) | public abstract class MultiTransformFuture<T, F> extends MultiFuture<T> ...
method onCompleted (line 4) | @Override
method error (line 21) | protected void error(Exception e) {
method transform (line 25) | protected abstract void transform(F result) throws Exception;
FILE: androidasync/src/main/java/com/jeffmony/async/future/SimpleCancellable.java
class SimpleCancellable (line 3) | public class SimpleCancellable implements DependentCancellable {
method isDone (line 5) | @Override
method cancelCleanup (line 10) | protected void cancelCleanup() {
method cleanup (line 13) | protected void cleanup() {
method completeCleanup (line 16) | protected void completeCleanup() {
method setComplete (line 19) | public boolean setComplete() {
method cancel (line 35) | @Override
method setParent (line 57) | @Override
method isCancelled (line 67) | @Override
method reset (line 86) | public Cancellable reset() {
FILE: androidasync/src/main/java/com/jeffmony/async/future/SimpleFuture.java
class SimpleFuture (line 10) | public class SimpleFuture<T> extends SimpleCancellable implements Depend...
type FutureCallbackInternal (line 17) | protected interface FutureCallbackInternal<T> {
method onCompleted (line 18) | void onCompleted(Exception e, T result, FutureCallsite next);
method SimpleFuture (line 21) | public SimpleFuture() {
method SimpleFuture (line 24) | public SimpleFuture(T value) {
method SimpleFuture (line 28) | public SimpleFuture(Exception e) {
method SimpleFuture (line 32) | public SimpleFuture(Future<T> future) {
method cancel (line 36) | @Override
method cancelInternal (line 41) | private boolean cancelInternal(boolean silent) {
method cancelSilently (line 56) | public boolean cancelSilently() {
method cancel (line 60) | @Override
method get (line 65) | @Override
method getResultOrThrow (line 77) | private T getResultOrThrow() throws ExecutionException {
method get (line 83) | @Override
method setComplete (line 96) | @Override
method handleInternalCompleteLocked (line 101) | private FutureCallbackInternal<T> handleInternalCompleteLocked() {
class FutureCallsite (line 113) | static class FutureCallsite {
method loop (line 118) | void loop() {
method handleCallbackUnlocked (line 135) | private void handleCallbackUnlocked(FutureCallsite callsite, FutureCal...
method releaseWaiterLocked (line 156) | void releaseWaiterLocked() {
method ensureWaiterLocked (line 163) | AsyncSemaphore ensureWaiterLocked() {
method setComplete (line 169) | public boolean setComplete(Exception e) {
method setCompleteException (line 172) | public boolean setCompleteException(Exception e) { return setComplete(...
method setComplete (line 174) | public boolean setComplete(T value) {
method setCompleteValue (line 177) | public boolean setCompleteValue(T value) {
method setComplete (line 181) | public boolean setComplete(Exception e, T value) {
method setComplete (line 185) | private boolean setComplete(Exception e, T value, FutureCallsite calls...
method setCallbackInternal (line 199) | void setCallbackInternal(FutureCallsite callsite, FutureCallbackIntern...
method setCallback (line 211) | @Override
method setComplete (line 219) | private Future<T> setComplete(Future<T> future, FutureCallsite callsit...
method setComplete (line 241) | public Future<T> setComplete(Future<T> future) {
method setCompleteFuture (line 245) | public Future<T> setCompleteFuture(Future<T> future) {
method getCallback (line 254) | @Deprecated
method done (line 259) | @Override
method success (line 280) | @Override
method then (line 301) | @Override
method thenConvert (line 324) | @Override
method fail (line 329) | @Override
method failRecover (line 337) | @Override
method failConvert (line 359) | @Override
method setParent (line 364) | @Override
method reset (line 373) | public SimpleFuture<T> reset() {
method tryGetException (line 385) | @Override
method tryGet (line 390) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/future/SuccessCallback.java
type SuccessCallback (line 3) | public interface SuccessCallback<T> {
method success (line 4) | void success(T value) throws Exception;
FILE: androidasync/src/main/java/com/jeffmony/async/future/ThenCallback.java
type ThenCallback (line 3) | public interface ThenCallback<T, F> {
method then (line 11) | T then(F from) throws Exception;
FILE: androidasync/src/main/java/com/jeffmony/async/future/ThenFutureCallback.java
type ThenFutureCallback (line 3) | public interface ThenFutureCallback<T, F> {
method then (line 11) | Future<T> then(F from) throws Exception;
FILE: androidasync/src/main/java/com/jeffmony/async/future/TransformFuture.java
class TransformFuture (line 3) | public abstract class TransformFuture<T, F> extends SimpleFuture<T> impl...
method TransformFuture (line 4) | public TransformFuture(F from) {
method TransformFuture (line 8) | public TransformFuture() {
method onCompleted (line 11) | @Override
method error (line 28) | protected void error(Exception e) {
method transform (line 32) | protected abstract void transform(F result) throws Exception;
FILE: androidasync/src/main/java/com/jeffmony/async/future/TypeConverter.java
type TypeConverter (line 3) | public interface TypeConverter<T, F> {
method convert (line 4) | Future<T> convert(F from, String fromMime) throws Exception;
FILE: androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpClient.java
class AsyncHttpClient (line 49) | public class AsyncHttpClient {
method getDefaultInstance (line 51) | public static AsyncHttpClient getDefaultInstance() {
method getMiddleware (line 59) | public Collection<AsyncHttpClientMiddleware> getMiddleware() {
method insertMiddleware (line 62) | public void insertMiddleware(AsyncHttpClientMiddleware middleware) {
method AsyncHttpClient (line 70) | public AsyncHttpClient(AsyncServer server) {
method setupAndroidProxy (line 78) | @SuppressLint("NewApi")
method getSocketMiddleware (line 114) | public AsyncSocketMiddleware getSocketMiddleware() {
method getSSLSocketMiddleware (line 118) | public AsyncSSLSocketMiddleware getSSLSocketMiddleware() {
method execute (line 122) | public Future<AsyncHttpResponse> execute(final AsyncHttpRequest reques...
method execute (line 128) | public Future<AsyncHttpResponse> execute(String uri, final HttpConnect...
class FutureAsyncHttpResponse (line 133) | private class FutureAsyncHttpResponse extends SimpleFuture<AsyncHttpRe...
method cancel (line 138) | @Override
method reportConnectedCompleted (line 155) | private void reportConnectedCompleted(FutureAsyncHttpResponse cancel, ...
method execute (line 180) | private void execute(final AsyncHttpRequest request, final int redirec...
method getTimeoutRemaining (line 194) | private static long getTimeoutRemaining(AsyncHttpRequest request) {
method copyHeader (line 200) | private static void copyHeader(AsyncHttpRequest from, AsyncHttpRequest...
method executeAffinity (line 206) | private void executeAffinity(final AsyncHttpRequest request, final int...
method executeSocket (line 310) | private void executeSocket(final AsyncHttpRequest request, final int r...
class RequestCallbackBase (line 495) | public static abstract class RequestCallbackBase<T> implements Request...
method onProgress (line 496) | @Override
method onConnect (line 499) | @Override
class DownloadCallback (line 504) | public static abstract class DownloadCallback extends RequestCallbackB...
class StringCallback (line 507) | public static abstract class StringCallback extends RequestCallbackBas...
class JSONObjectCallback (line 510) | public static abstract class JSONObjectCallback extends RequestCallbac...
class JSONArrayCallback (line 513) | public static abstract class JSONArrayCallback extends RequestCallback...
class FileCallback (line 516) | public static abstract class FileCallback extends RequestCallbackBase<...
method executeByteBufferList (line 519) | public Future<ByteBufferList> executeByteBufferList(AsyncHttpRequest r...
method executeString (line 523) | public Future<String> executeString(AsyncHttpRequest req, final String...
method executeJSONObject (line 527) | public Future<JSONObject> executeJSONObject(AsyncHttpRequest req, fina...
method executeJSONArray (line 531) | public Future<JSONArray> executeJSONArray(AsyncHttpRequest req, final ...
method invokeWithAffinity (line 535) | private <T> void invokeWithAffinity(final RequestCallback<T> callback,...
method invoke (line 547) | private <T> void invoke(final RequestCallback<T> callback, final Simpl...
method invokeProgress (line 557) | private void invokeProgress(final RequestCallback callback, final Asyn...
method invokeConnect (line 562) | private void invokeConnect(final RequestCallback callback, final Async...
method executeFile (line 567) | public Future<File> executeFile(AsyncHttpRequest req, final String fil...
method execute (line 648) | public <T> SimpleFuture<T> execute(AsyncHttpRequest req, final AsyncPa...
type WebSocketConnectCallback (line 668) | public interface WebSocketConnectCallback {
method onCompleted (line 669) | void onCompleted(Exception ex, WebSocket webSocket);
method websocket (line 672) | public Future<WebSocket> websocket(final AsyncHttpRequest req, String ...
method websocket (line 676) | public Future<WebSocket> websocket(final AsyncHttpRequest req, String[...
method websocket (line 706) | public Future<WebSocket> websocket(String uri, String protocol, final ...
method websocket (line 712) | public Future<WebSocket> websocket(String uri, String[] protocols, fin...
method getServer (line 718) | public AsyncServer getServer() {
FILE: androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpClientMiddleware.java
type AsyncHttpClientMiddleware (line 15) | public interface AsyncHttpClientMiddleware {
type ResponseHead (line 16) | interface ResponseHead {
method socket (line 17) | AsyncSocket socket();
method protocol (line 18) | String protocol();
method message (line 19) | String message();
method code (line 20) | int code();
method protocol (line 21) | ResponseHead protocol(String protocol);
method message (line 22) | ResponseHead message(String message);
method code (line 23) | ResponseHead code(int code);
method headers (line 24) | Headers headers();
method headers (line 25) | ResponseHead headers(Headers headers);
method sink (line 26) | DataSink sink();
method sink (line 27) | ResponseHead sink(DataSink sink);
method emitter (line 28) | DataEmitter emitter();
method emitter (line 29) | ResponseHead emitter(DataEmitter emitter);
class OnRequestData (line 32) | class OnRequestData {
class GetSocketData (line 37) | class GetSocketData extends OnRequestData {
class OnExchangeHeaderData (line 43) | class OnExchangeHeaderData extends GetSocketData {
class OnRequestSentData (line 50) | class OnRequestSentData extends OnExchangeHeaderData {
class OnHeadersReceivedData (line 53) | class OnHeadersReceivedData extends OnRequestSentData {
class OnBodyDecoderData (line 56) | class OnBodyDecoderData extends OnHeadersReceivedData {
class OnResponseReadyData (line 60) | class OnResponseReadyData extends OnBodyDecoderData {
class OnResponseCompleteData (line 63) | class OnResponseCompleteData extends OnResponseReadyData {
method onRequest (line 71) | void onRequest(OnRequestData data);
method getSocket (line 78) | Cancellable getSocket(GetSocketData data);
method exchangeHeaders (line 86) | boolean exchangeHeaders(OnExchangeHeaderData data);
method onRequestSent (line 93) | void onRequestSent(OnRequestSentData data);
method onHeadersReceived (line 99) | void onHeadersReceived(OnHeadersReceivedData data);
method onBodyDecoder (line 105) | void onBodyDecoder(OnBodyDecoderData data);
method onResponseReady (line 114) | AsyncHttpRequest onResponseReady(OnResponseReadyData data);
method onResponseComplete (line 121) | void onResponseComplete(OnResponseCompleteData data);
FILE: androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpDelete.java
class AsyncHttpDelete (line 5) | public class AsyncHttpDelete extends AsyncHttpRequest {
method AsyncHttpDelete (line 8) | public AsyncHttpDelete(String uri) {
method AsyncHttpDelete (line 12) | public AsyncHttpDelete(Uri uri) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpGet.java
class AsyncHttpGet (line 5) | public class AsyncHttpGet extends AsyncHttpRequest {
method AsyncHttpGet (line 8) | public AsyncHttpGet(String uri) {
method AsyncHttpGet (line 12) | public AsyncHttpGet(Uri uri) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpHead.java
class AsyncHttpHead (line 8) | public class AsyncHttpHead extends AsyncHttpRequest {
method AsyncHttpHead (line 9) | public AsyncHttpHead(Uri uri) {
method hasBody (line 13) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpPost.java
class AsyncHttpPost (line 5) | public class AsyncHttpPost extends AsyncHttpRequest {
method AsyncHttpPost (line 8) | public AsyncHttpPost(String uri) {
method AsyncHttpPost (line 12) | public AsyncHttpPost(Uri uri) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpPut.java
class AsyncHttpPut (line 5) | public class AsyncHttpPut extends AsyncHttpRequest {
method AsyncHttpPut (line 8) | public AsyncHttpPut(String uri) {
method AsyncHttpPut (line 12) | public AsyncHttpPut(Uri uri) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpRequest.java
class AsyncHttpRequest (line 11) | public class AsyncHttpRequest {
method getRequestLine (line 12) | public RequestLine getRequestLine() {
method hasBody (line 45) | public boolean hasBody() {
method getPath (line 49) | public String getPath() {
method getDefaultUserAgent (line 53) | protected static String getDefaultUserAgent() {
method getMethod (line 60) | public String getMethod() {
method setRequestLineProtocol (line 64) | public void setRequestLineProtocol(String scheme) {
method getRequestLineProtocol (line 68) | public String getRequestLineProtocol() {
method setMethod (line 72) | public AsyncHttpRequest setMethod(String method) {
method AsyncHttpRequest (line 79) | public AsyncHttpRequest(Uri uri, String method) {
method setDefaultHeaders (line 83) | public static void setDefaultHeaders(Headers ret, Uri uri) {
method AsyncHttpRequest (line 99) | public AsyncHttpRequest(Uri uri, String method, Headers headers) {
method getUri (line 112) | public Uri getUri() {
method getHeaders (line 118) | public Headers getHeaders() {
method getFollowRedirect (line 123) | public boolean getFollowRedirect() {
method setFollowRedirect (line 126) | public AsyncHttpRequest setFollowRedirect(boolean follow) {
method setBody (line 132) | public void setBody(AsyncHttpRequestBody body) {
method getBody (line 136) | public AsyncHttpRequestBody getBody() {
method onHandshakeException (line 140) | public void onHandshakeException(AsyncSSLException e) {
method getTimeout (line 145) | public int getTimeout() {
method setTimeout (line 149) | public AsyncHttpRequest setTimeout(int timeout) {
method setHeader (line 154) | public AsyncHttpRequest setHeader(String name, String value) {
method addHeader (line 159) | public AsyncHttpRequest addHeader(String name, String value) {
method enableProxy (line 166) | public void enableProxy(String host, int port) {
method disableProxy (line 171) | public void disableProxy() {
method getProxyHost (line 176) | public String getProxyHost() {
method getProxyPort (line 180) | public int getProxyPort() {
method toString (line 184) | @Override
method setLogging (line 191) | public void setLogging(String tag, int level) {
method getLogLevel (line 198) | public int getLogLevel() {
method getLogTag (line 201) | public String getLogTag() {
method getLogMessage (line 205) | private String getLogMessage(String message) {
method logi (line 213) | public void logi(String message) {
method logv (line 220) | public void logv(String message) {
method logw (line 227) | public void logw(String message) {
method logd (line 234) | public void logd(String message) {
method logd (line 241) | public void logd(String message, Exception e) {
method loge (line 249) | public void loge(String message) {
method loge (line 256) | public void loge(String message, Exception e) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpResponse.java
type AsyncHttpResponse (line 6) | public interface AsyncHttpResponse extends DataEmitter {
method protocol (line 7) | String protocol();
method message (line 8) | String message();
method code (line 9) | int code();
method headers (line 10) | Headers headers();
method detachSocket (line 11) | AsyncSocket detachSocket();
method getRequest (line 12) | AsyncHttpRequest getRequest();
FILE: androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpResponseImpl.java
class AsyncHttpResponseImpl (line 14) | abstract class AsyncHttpResponseImpl extends FilteredDataEmitter impleme...
method socket (line 15) | public AsyncSocket socket() {
method getRequest (line 19) | @Override
method setSocket (line 24) | void setSocket(AsyncSocket exchange) {
method onHeadersSent (line 32) | protected void onHeadersSent() {
method onRequestCompleted (line 46) | protected void onRequestCompleted(Exception ex) {
method onCompleted (line 50) | @Override
method onHeadersReceived (line 64) | protected void onHeadersReceived() {
method emitter (line 68) | @Override
method emitter (line 73) | @Override
method terminate (line 79) | private void terminate() {
method report (line 92) | @Override
method close (line 103) | @Override
method AsyncHttpResponseImpl (line 112) | public AsyncHttpResponseImpl(AsyncHttpRequest request) {
method headers (line 118) | @Override
method headers (line 123) | @Override
method code (line 130) | @Override
method code (line 135) | @Override
method protocol (line 141) | @Override
method message (line 147) | @Override
method protocol (line 154) | @Override
method message (line 160) | @Override
method toString (line 165) | @Override
method assertContent (line 173) | private void assertContent() {
method sink (line 183) | @Override
method sink (line 188) | @Override
method getServer (line 194) | @Override
method charset (line 199) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/AsyncSSLEngineConfigurator.java
type AsyncSSLEngineConfigurator (line 6) | public interface AsyncSSLEngineConfigurator {
method createEngine (line 7) | SSLEngine createEngine(SSLContext sslContext, String peerHost, int pee...
method configureEngine (line 8) | void configureEngine(SSLEngine engine, AsyncHttpClientMiddleware.GetSo...
FILE: androidasync/src/main/java/com/jeffmony/async/http/AsyncSSLSocketMiddleware.java
class AsyncSSLSocketMiddleware (line 24) | public class AsyncSSLSocketMiddleware extends AsyncSocketMiddleware {
method AsyncSSLSocketMiddleware (line 25) | public AsyncSSLSocketMiddleware(AsyncHttpClient client) {
method setSSLContext (line 31) | public void setSSLContext(SSLContext sslContext) {
method getSSLContext (line 35) | public SSLContext getSSLContext() {
method setTrustManagers (line 41) | public void setTrustManagers(TrustManager[] trustManagers) {
method setHostnameVerifier (line 47) | public void setHostnameVerifier(HostnameVerifier hostnameVerifier) {
method addEngineConfigurator (line 53) | public void addEngineConfigurator(AsyncSSLEngineConfigurator engineCon...
method clearEngineConfigurators (line 57) | public void clearEngineConfigurators() {
method createConfiguredSSLEngine (line 61) | protected SSLEngine createConfiguredSSLEngine(GetSocketData data, Stri...
method createHandshakeCallback (line 78) | protected AsyncSSLSocketWrapper.HandshakeCallback createHandshakeCallb...
method tryHandshake (line 87) | protected void tryHandshake(AsyncSocket socket, GetSocketData data, fi...
method wrapCallback (line 94) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/AsyncSocketMiddleware.java
class AsyncSocketMiddleware (line 22) | public class AsyncSocketMiddleware extends SimpleMiddleware {
method AsyncSocketMiddleware (line 28) | public AsyncSocketMiddleware(AsyncHttpClient client, String scheme, in...
method setIdleTimeoutMs (line 34) | public void setIdleTimeoutMs(int idleTimeoutMs) {
method getSchemePort (line 38) | public int getSchemePort(Uri uri) {
method AsyncSocketMiddleware (line 49) | public AsyncSocketMiddleware(AsyncHttpClient client) {
method wrapCallback (line 55) | protected ConnectCallback wrapCallback(GetSocketData data, Uri uri, in...
method getConnectAllAddresses (line 60) | public boolean getConnectAllAddresses() {
method setConnectAllAddresses (line 64) | public void setConnectAllAddresses(boolean connectAllAddresses) {
method disableProxy (line 72) | public void disableProxy() {
method enableProxy (line 78) | public void enableProxy(String host, int port) {
method computeLookup (line 84) | String computeLookup(Uri uri, int port, String proxyHost, int proxyPor...
class IdleSocketHolder (line 97) | class IdleSocketHolder {
method IdleSocketHolder (line 98) | public IdleSocketHolder(AsyncSocket socket) {
class ConnectionInfo (line 105) | static class ConnectionInfo {
method getMaxConnectionCount (line 114) | public int getMaxConnectionCount() {
method setMaxConnectionCount (line 118) | public void setMaxConnectionCount(int maxConnectionCount) {
method getSocket (line 122) | @Override
method getOrCreateConnectionInfo (line 228) | private ConnectionInfo getOrCreateConnectionInfo(String lookup) {
method maybeCleanupConnectionInfo (line 237) | private void maybeCleanupConnectionInfo(String lookup) {
method recycleSocket (line 255) | private void recycleSocket(final AsyncSocket socket, AsyncHttpRequest ...
method idleSocket (line 279) | private void idleSocket(final AsyncSocket socket) {
method nextConnection (line 302) | private void nextConnection(AsyncHttpRequest request) {
method isKeepAlive (line 323) | protected boolean isKeepAlive(OnResponseCompleteData data) {
method onResponseComplete (line 327) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/BasicNameValuePair.java
class BasicNameValuePair (line 104) | public class BasicNameValuePair implements NameValuePair, Cloneable {
method BasicNameValuePair (line 115) | public BasicNameValuePair(final String name, final String value) {
method getName (line 129) | public String getName() {
method getValue (line 138) | public String getValue() {
method toString (line 148) | public String toString() {
method equals (line 152) | public boolean equals(final Object object) {
method hashCode (line 164) | public int hashCode() {
method clone (line 168) | public Object clone() throws CloneNotSupportedException {
FILE: androidasync/src/main/java/com/jeffmony/async/http/BodyDecoderException.java
class BodyDecoderException (line 3) | public class BodyDecoderException extends Exception {
method BodyDecoderException (line 4) | public BodyDecoderException(String message) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/ConnectionClosedException.java
class ConnectionClosedException (line 3) | public class ConnectionClosedException extends Exception {
method ConnectionClosedException (line 4) | public ConnectionClosedException(String message) {
method ConnectionClosedException (line 8) | public ConnectionClosedException(String detailMessage, Throwable throw...
FILE: androidasync/src/main/java/com/jeffmony/async/http/ConnectionFailedException.java
class ConnectionFailedException (line 3) | public class ConnectionFailedException extends Exception {
method ConnectionFailedException (line 4) | public ConnectionFailedException(String message) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/Headers.java
class Headers (line 13) | public class Headers {
method Headers (line 14) | public Headers() {
method Headers (line 17) | public Headers(Map<String, List<String>> mm) {
method newList (line 24) | @Override
method getMultiMap (line 29) | public Multimap getMultiMap() {
method getAll (line 33) | public List<String> getAll(String header) {
method get (line 37) | public String get(String header) {
method set (line 41) | public Headers set(String header, String value) {
method add (line 51) | public Headers add(String header, String value) {
method addLine (line 59) | public Headers addLine(String line) {
method addAll (line 71) | public Headers addAll(String header, List<String> values) {
method addAll (line 78) | public Headers addAll(Map<String, List<String>> m) {
method addAllMap (line 87) | public Headers addAllMap(Map<String, String> m) {
method addAll (line 94) | public Headers addAll(Headers headers) {
method removeAll (line 100) | public List<String> removeAll(String header) {
method remove (line 104) | public String remove(String header) {
method removeAll (line 111) | public Headers removeAll(Collection<String> headers) {
method toStringBuilder (line 118) | public StringBuilder toStringBuilder() {
method toString (line 133) | @Override
method toPrefixString (line 138) | public String toPrefixString(String prefix) {
method parse (line 145) | public static Headers parse(String payload) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/HttpDate.java
class HttpDate (line 29) | public final class HttpDate {
method initialValue (line 37) | @Override
method parse (line 72) | public static Date parse(String value) {
method format (line 91) | public static String format(Date value) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/HttpTransportMiddleware.java
class HttpTransportMiddleware (line 20) | public class HttpTransportMiddleware extends SimpleMiddleware {
method exchangeHeaders (line 21) | @Override
method responseIsEmpty (line 138) | static boolean responseIsEmpty(int code) {
method onRequestSent (line 142) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/HttpUtil.java
class HttpUtil (line 17) | public class HttpUtil {
method getBody (line 18) | public static AsyncHttpRequestBody getBody(DataEmitter emitter, Comple...
class EndEmitter (line 44) | static class EndEmitter extends FilteredDataEmitter {
method EndEmitter (line 45) | private EndEmitter() {
method create (line 48) | public static EndEmitter create(AsyncServer server, final Exception ...
method getBodyDecoder (line 62) | public static DataEmitter getBodyDecoder(DataEmitter emitter, Protocol...
method isKeepAlive (line 118) | public static boolean isKeepAlive(Protocol protocol, Headers headers) {
method isKeepAlive (line 126) | public static boolean isKeepAlive(String protocol, Headers headers) {
method contentLength (line 134) | public static long contentLength(Headers headers) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/HybiParser.java
class HybiParser (line 48) | abstract class HybiParser {
method mask (line 109) | private static byte[] mask(byte[] payload, byte[] mask, int offset) {
method inflate (line 118) | private byte[] inflate(byte[] payload) throws DataFormatException {
method setMasking (line 136) | public void setMasking(boolean masking) {
method setDeflate (line 140) | public void setDeflate(boolean deflate) {
method onDataAvailable (line 145) | @Override
method onDataAvailable (line 159) | @Override
method onDataAvailable (line 167) | @Override
method onDataAvailable (line 183) | @Override
method onDataAvailable (line 193) | @Override
method parse (line 210) | void parse() {
method HybiParser (line 247) | public HybiParser(DataEmitter socket) {
method parseOpcode (line 252) | private void parseOpcode(byte data) throws ProtocolError {
method parseLength (line 278) | private void parseLength(byte data) {
method parseExtendedLength (line 290) | private void parseExtendedLength(byte[] buffer) throws ProtocolError {
method frame (line 295) | public byte[] frame(String data) {
method frame (line 299) | public byte[] frame(byte[] data) {
method frame (line 303) | public byte[] frame(byte[] data, int offset, int length) {
method pingFrame (line 307) | public byte[] pingFrame(String data) {
method pongFrame (line 311) | public byte[] pongFrame(String data) {
method frame (line 323) | private byte[] frame(int opcode, byte[] data, int errorCode) {
method frame (line 335) | private byte[] frame(int opcode, String data, int errorCode) {
method frame (line 339) | private byte[] frame(int opcode, byte [] data, int errorCode, int data...
method close (line 391) | public void close(int code, String reason) {
method emitFrame (line 397) | private void emitFrame() throws IOException {
method onMessage (line 459) | protected abstract void onMessage(byte[] payload);
method onMessage (line 460) | protected abstract void onMessage(String payload);
method onPong (line 461) | protected abstract void onPong(String payload);
method onPing (line 462) | protected abstract void onPing(String payload);
method onDisconnect (line 463) | protected abstract void onDisconnect(int code, String reason);
method report (line 464) | protected abstract void report(Exception ex);
method sendFrame (line 466) | protected abstract void sendFrame(byte[] frame);
method reset (line 468) | private void reset() {
method encode (line 473) | private String encode(byte[] buffer) {
method decode (line 481) | private byte[] decode(String string) {
method getInteger (line 489) | private int getInteger(byte[] bytes) throws ProtocolError {
method slice (line 497) | private byte[] slice(byte[] array, int start) {
method finalize (line 503) | @Override
class ProtocolError (line 518) | public static class ProtocolError extends IOException {
method ProtocolError (line 519) | public ProtocolError(String detailMessage) {
method byteArrayToLong (line 524) | private static long byteArrayToLong(byte[] b, int offset, int length) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/Multimap.java
class Multimap (line 17) | public class Multimap extends LinkedHashMap<String, List<String>> implem...
method Multimap (line 18) | public Multimap() {
method newList (line 21) | protected List<String> newList() {
method getString (line 25) | public String getString(String name) {
method getAllString (line 32) | public String getAllString(String name, String delimiter) {
method ensure (line 48) | public List<String> ensure(String name) {
method add (line 57) | public void add(String name, String value) {
method put (line 61) | public void put(String name, String value) {
method Multimap (line 67) | public Multimap(List<NameValuePair> pairs) {
method Multimap (line 72) | public Multimap(Multimap m) {
type StringDecoder (line 76) | public interface StringDecoder {
method decode (line 77) | public String decode(String s);
method parse (line 80) | public static Multimap parse(String value, String delimiter, boolean u...
method parse (line 84) | public static Multimap parse(String value, String delimiter, String as...
method parseSemicolonDelimited (line 109) | public static Multimap parseSemicolonDelimited(String header) {
method parseCommaDelimited (line 113) | public static Multimap parseCommaDelimited(String header) {
method decode (line 118) | @Override
method parseQuery (line 124) | public static Multimap parseQuery(String query) {
method decode (line 129) | @Override
method parseUrlEncoded (line 135) | public static Multimap parseUrlEncoded(String query) {
method iterator (line 139) | @Override
method toSingleMap (line 151) | public Map<String, String> toSingleMap() {
FILE: androidasync/src/main/java/com/jeffmony/async/http/NameValuePair.java
type NameValuePair (line 102) | public interface NameValuePair {
method getName (line 104) | String getName();
method getValue (line 106) | String getValue();
FILE: androidasync/src/main/java/com/jeffmony/async/http/Protocol.java
type Protocol (line 18) | public enum Protocol {
method needsSpdyConnection (line 45) | @Override
method needsSpdyConnection (line 64) | @Override
method Protocol (line 81) | Protocol(String protocol) {
method get (line 88) | public static Protocol get(String protocol) {
method toString (line 98) | @Override
method needsSpdyConnection (line 103) | public boolean needsSpdyConnection() {
FILE: androidasync/src/main/java/com/jeffmony/async/http/ProtocolVersion.java
class ProtocolVersion (line 55) | public class ProtocolVersion implements Serializable, Cloneable {
method ProtocolVersion (line 77) | public ProtocolVersion(String protocol, int major, int minor) {
method getProtocol (line 100) | public final String getProtocol() {
method getMajor (line 109) | public final int getMajor() {
method getMinor (line 118) | public final int getMinor() {
method forVersion (line 138) | public ProtocolVersion forVersion(int major, int minor) {
method hashCode (line 154) | public final int hashCode() {
method equals (line 172) | public final boolean equals(Object obj) {
method isComparable (line 197) | public boolean isComparable(ProtocolVersion that) {
method compareToVersion (line 218) | public int compareToVersion(ProtocolVersion that) {
method greaterEquals (line 247) | public final boolean greaterEquals(ProtocolVersion version) {
method lessEquals (line 262) | public final boolean lessEquals(ProtocolVersion version) {
method toString (line 272) | public String toString() {
method clone (line 282) | public Object clone() throws CloneNotSupportedException {
FILE: androidasync/src/main/java/com/jeffmony/async/http/RedirectLimitExceededException.java
class RedirectLimitExceededException (line 3) | public class RedirectLimitExceededException extends Exception {
method RedirectLimitExceededException (line 4) | public RedirectLimitExceededException(String message) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/RequestLine.java
type RequestLine (line 45) | public interface RequestLine {
method getMethod (line 47) | String getMethod();
method getProtocolVersion (line 49) | ProtocolVersion getProtocolVersion();
method getUri (line 51) | String getUri();
FILE: androidasync/src/main/java/com/jeffmony/async/http/SSLEngineSNIConfigurator.java
class SSLEngineSNIConfigurator (line 14) | public class SSLEngineSNIConfigurator implements AsyncSSLEngineConfigura...
class EngineHolder (line 15) | private static class EngineHolder implements AsyncSSLEngineConfigurator {
method createEngine (line 22) | @Override
method EngineHolder (line 27) | public EngineHolder(Class engineClass) {
method configureEngine (line 45) | @Override
method createEngine (line 62) | @Override
method ensureHolder (line 75) | EngineHolder ensureHolder(SSLEngine engine) {
method configureEngine (line 85) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/SimpleMiddleware.java
class SimpleMiddleware (line 5) | public class SimpleMiddleware implements AsyncHttpClientMiddleware {
method onRequest (line 6) | @Override
method getSocket (line 10) | @Override
method exchangeHeaders (line 15) | @Override
method onRequestSent (line 20) | @Override
method onHeadersReceived (line 24) | @Override
method onBodyDecoder (line 28) | @Override
method onResponseReady (line 32) | @Override
method onResponseComplete (line 37) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/TaggedList.java
class TaggedList (line 5) | public class TaggedList<T> extends ArrayList<T> {
method tag (line 8) | public synchronized <V> V tag() {
method tag (line 12) | public synchronized <V> void tag(V tag) {
method tagNull (line 16) | public synchronized <V> void tagNull(V tag) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/WebSocket.java
type WebSocket (line 5) | public interface WebSocket extends AsyncSocket {
type StringCallback (line 6) | interface StringCallback {
method onStringAvailable (line 7) | void onStringAvailable(String s);
type PingCallback (line 9) | interface PingCallback {
method onPingReceived (line 10) | void onPingReceived(String s);
type PongCallback (line 12) | interface PongCallback {
method onPongReceived (line 13) | void onPongReceived(String s);
method send (line 16) | void send(byte[] bytes);
method send (line 17) | void send(String string);
method send (line 18) | void send(byte[] bytes, int offset, int len);
method ping (line 19) | void ping(String message);
method pong (line 20) | void pong(String message);
method setStringCallback (line 22) | void setStringCallback(StringCallback callback);
method getStringCallback (line 23) | StringCallback getStringCallback();
method setPingCallback (line 25) | void setPingCallback(PingCallback callback);
method setPongCallback (line 27) | void setPongCallback(PongCallback callback);
method getPongCallback (line 28) | PongCallback getPongCallback();
method isBuffering (line 30) | boolean isBuffering();
method getProtocol (line 31) | String getProtocol();
method getSocket (line 33) | AsyncSocket getSocket();
FILE: androidasync/src/main/java/com/jeffmony/async/http/WebSocketHandshakeException.java
class WebSocketHandshakeException (line 3) | public class WebSocketHandshakeException extends Exception {
method WebSocketHandshakeException (line 4) | public WebSocketHandshakeException(String message) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/WebSocketImpl.java
class WebSocketImpl (line 23) | public class WebSocketImpl implements WebSocket {
method end (line 24) | @Override
method toByteArray (line 29) | private static byte[] toByteArray(UUID uuid) {
method SHA1 (line 37) | private static String SHA1(String text) {
method addAndEmit (line 53) | private void addAndEmit(ByteBufferList bb) {
method setupParser (line 73) | private void setupParser(boolean masking, boolean deflate) {
method WebSocketImpl (line 121) | public WebSocketImpl(AsyncHttpServerRequest request, AsyncHttpServerRe...
method getProtocol (line 145) | @Override
method addWebSocketUpgradeHeaders (line 150) | public static void addWebSocketUpgradeHeaders(AsyncHttpRequest req, St...
method WebSocketImpl (line 169) | public WebSocketImpl(AsyncSocket socket) {
method finishHandshake (line 174) | public static WebSocket finishHandshake(Headers requestHeaders, AsyncH...
method close (line 211) | @Override
method setClosedCallback (line 216) | @Override
method getClosedCallback (line 221) | @Override
method setEndCallback (line 227) | @Override
method getEndCallback (line 232) | @Override
method send (line 237) | @Override
method send (line 242) | @Override
method send (line 247) | @Override
method ping (line 252) | @Override
method pong (line 257) | @Override
method setStringCallback (line 263) | @Override
method setDataCallback (line 269) | @Override
method getStringCallback (line 274) | @Override
method setPingCallback (line 280) | @Override
method setPongCallback (line 286) | @Override
method getPongCallback (line 291) | @Override
method getDataCallback (line 296) | @Override
method isOpen (line 301) | @Override
method isBuffering (line 306) | @Override
method write (line 311) | @Override
method setWriteableCallback (line 317) | @Override
method getWriteableCallback (line 322) | @Override
method getSocket (line 327) | @Override
method getServer (line 332) | @Override
method isChunked (line 337) | @Override
method pause (line 342) | @Override
method resume (line 347) | @Override
method isPaused (line 352) | @Override
method charset (line 357) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/body/AsyncHttpRequestBody.java
type AsyncHttpRequestBody (line 8) | public interface AsyncHttpRequestBody<T> {
method write (line 9) | void write(AsyncHttpRequest request, DataSink sink, CompletedCallback ...
method parse (line 10) | void parse(DataEmitter emitter, CompletedCallback completed);
method getContentType (line 11) | String getContentType();
method readFullyOnRequest (line 12) | boolean readFullyOnRequest();
method length (line 13) | int length();
method get (line 14) | T get();
FILE: androidasync/src/main/java/com/jeffmony/async/http/body/ByteBufferListRequestBody.java
class ByteBufferListRequestBody (line 11) | public class ByteBufferListRequestBody implements AsyncHttpRequestBody<B...
method ByteBufferListRequestBody (line 12) | public ByteBufferListRequestBody() {
method ByteBufferListRequestBody (line 16) | public ByteBufferListRequestBody(ByteBufferList bb) {
method write (line 19) | @Override
method parse (line 24) | @Override
method getContentType (line 34) | @Override
method readFullyOnRequest (line 39) | @Override
method length (line 44) | @Override
method get (line 49) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/body/DocumentBody.java
class DocumentBody (line 25) | public class DocumentBody implements AsyncHttpRequestBody<Document> {
method DocumentBody (line 26) | public DocumentBody() {
method DocumentBody (line 30) | public DocumentBody(Document document) {
method prepare (line 35) | private void prepare() {
method write (line 53) | @Override
method parse (line 60) | @Override
method getContentType (line 73) | @Override
method readFullyOnRequest (line 78) | @Override
method length (line 83) | @Override
method get (line 90) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/body/FileBody.java
class FileBody (line 14) | public class FileBody implements AsyncHttpRequestBody<File> {
method FileBody (line 20) | public FileBody(File file) {
method FileBody (line 24) | public FileBody(File file, String contentType) {
method write (line 29) | @Override
method parse (line 34) | @Override
method getContentType (line 39) | @Override
method setContentType (line 44) | public void setContentType(String contentType) {
method readFullyOnRequest (line 48) | @Override
method length (line 53) | @Override
method get (line 58) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/body/FilePart.java
class FilePart (line 12) | public class FilePart extends StreamPart {
method FilePart (line 14) | public FilePart(String name, final File file) {
method getInputStream (line 26) | @Override
method toString (line 31) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/body/JSONArrayBody.java
class JSONArrayBody (line 13) | public class JSONArrayBody implements AsyncHttpRequestBody<JSONArray> {
method JSONArrayBody (line 14) | public JSONArrayBody() {
method JSONArrayBody (line 19) | public JSONArrayBody(JSONArray json) {
method parse (line 24) | @Override
method write (line 35) | @Override
method getContentType (line 40) | @Override
method readFullyOnRequest (line 45) | @Override
method length (line 50) | @Override
method get (line 58) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/body/JSONObjectBody.java
class JSONObjectBody (line 13) | public class JSONObjectBody implements AsyncHttpRequestBody<JSONObject> {
method JSONObjectBody (line 14) | public JSONObjectBody() {
method JSONObjectBody (line 19) | public JSONObjectBody(JSONObject json) {
method parse (line 24) | @Override
method write (line 35) | @Override
method getContentType (line 40) | @Override
method readFullyOnRequest (line 45) | @Override
method length (line 50) | @Override
method get (line 58) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/body/MultipartFormDataBody.java
class MultipartFormDataBody (line 24) | public class MultipartFormDataBody extends BoundaryEmitter implements As...
type MultipartCallback (line 30) | public interface MultipartCallback {
method onPart (line 31) | public void onPart(Part part);
method parse (line 34) | @Override
method handleLast (line 40) | void handleLast() {
method getField (line 59) | public String getField(String name) {
method onBoundaryEnd (line 65) | @Override
method onBoundaryStart (line 71) | @Override
method MultipartFormDataBody (line 113) | public MultipartFormDataBody(String contentType) {
method setMultipartCallback (line 123) | public void setMultipartCallback(MultipartCallback callback) {
method getMultipartCallback (line 127) | public MultipartCallback getMultipartCallback() {
method write (line 132) | @Override
method getContentType (line 188) | @Override
method readFullyOnRequest (line 196) | @Override
method length (line 202) | @Override
method MultipartFormDataBody (line 219) | public MultipartFormDataBody() {
method setContentType (line 222) | public void setContentType(String contentType) {
method getParts (line 226) | public List<Part> getParts() {
method addFilePart (line 232) | public void addFilePart(String name, File file) {
method addStringPart (line 236) | public void addStringPart(String name, String value) {
method addPart (line 241) | public void addPart(Part part) {
method get (line 247) | @Override
method toString (line 252) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/body/Part.java
class Part (line 13) | public class Part {
method Part (line 18) | public Part(Headers headers) {
method getName (line 23) | public String getName() {
method Part (line 28) | public Part(String name, long length, List<NameValuePair> contentDispo...
method getRawHeaders (line 41) | public Headers getRawHeaders() {
method getContentType (line 45) | public String getContentType() {
method setContentType (line 49) | public void setContentType(String contentType) {
method getFilename (line 53) | public String getFilename() {
method isFile (line 60) | public boolean isFile() {
method length (line 64) | public long length() {
method write (line 68) | public void write(DataSink sink, CompletedCallback callback) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/body/StreamBody.java
class StreamBody (line 11) | public class StreamBody implements AsyncHttpRequestBody<InputStream> {
method StreamBody (line 21) | public StreamBody(InputStream stream, int length) {
method write (line 26) | @Override
method parse (line 31) | @Override
method getContentType (line 37) | @Override
method setContentType (line 41) | public StreamBody setContentType(String contentType) {
method readFullyOnRequest (line 46) | @Override
method length (line 51) | @Override
method get (line 56) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/body/StreamPart.java
class StreamPart (line 12) | public abstract class StreamPart extends Part {
method StreamPart (line 13) | public StreamPart(String name, long length, List<NameValuePair> conten...
method write (line 17) | @Override
method getInputStream (line 28) | protected abstract InputStream getInputStream() throws IOException;
FILE: androidasync/src/main/java/com/jeffmony/async/http/body/StringBody.java
class StringBody (line 11) | public class StringBody implements AsyncHttpRequestBody<String> {
method StringBody (line 12) | public StringBody() {
method StringBody (line 17) | public StringBody(String string) {
method parse (line 22) | @Override
method write (line 35) | @Override
method getContentType (line 42) | @Override
method readFullyOnRequest (line 47) | @Override
method length (line 52) | @Override
method toString (line 59) | @Override
method get (line 64) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/body/StringPart.java
class StringPart (line 7) | public class StringPart extends StreamPart {
method StringPart (line 9) | public StringPart(String name, String value) {
method getInputStream (line 14) | @Override
method getValue (line 19) | public String getValue() {
method toString (line 23) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/body/UrlEncodedFormBody.java
class UrlEncodedFormBody (line 17) | public class UrlEncodedFormBody implements AsyncHttpRequestBody<Multimap> {
method UrlEncodedFormBody (line 21) | public UrlEncodedFormBody(Multimap parameters) {
method UrlEncodedFormBody (line 25) | public UrlEncodedFormBody(List<NameValuePair> parameters) {
method buildData (line 29) | private void buildData() {
method write (line 51) | @Override
method getContentType (line 59) | @Override
method parse (line 64) | @Override
method UrlEncodedFormBody (line 90) | public UrlEncodedFormBody() {
method readFullyOnRequest (line 93) | @Override
method length (line 98) | @Override
method get (line 105) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/cache/HeaderParser.java
class HeaderParser (line 19) | final class HeaderParser {
type CacheControlHandler (line 21) | public interface CacheControlHandler {
method handle (line 22) | void handle(String directive, String parameter);
method parseCacheControl (line 28) | public static void parseCacheControl(String value, CacheControlHandler...
method skipUntil (line 72) | private static int skipUntil(String input, int pos, String characters) {
method skipWhitespace (line 85) | private static int skipWhitespace(String input, int pos) {
method parseSeconds (line 99) | public static int parseSeconds(String value) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/cache/Objects.java
class Objects (line 19) | final class Objects {
method Objects (line 20) | private Objects() {}
method equal (line 25) | public static boolean equal(Object a, Object b) {
method hashCode (line 29) | public static int hashCode(Object o) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/cache/RawHeaders.java
class RawHeaders (line 47) | final class RawHeaders {
method compare (line 49) | @Override
method RawHeaders (line 69) | public RawHeaders() {}
method RawHeaders (line 71) | public RawHeaders(RawHeaders copyFrom) {
method copy (line 75) | public void copy(RawHeaders copyFrom) {
method setStatusLine (line 87) | public void setStatusLine(String statusLine) {
method getStatusLine (line 112) | public String getStatusLine() {
method getHttpMinorVersion (line 120) | public int getHttpMinorVersion() {
method getResponseCode (line 127) | public int getResponseCode() {
method getResponseMessage (line 134) | public String getResponseMessage() {
method addLine (line 142) | public void addLine(String line) {
method add (line 154) | public void add(String fieldName, String value) {
method removeAll (line 171) | public void removeAll(String fieldName) {
method addAll (line 180) | public void addAll(String fieldName, List<String> headerFields) {
method set (line 190) | public void set(String fieldName, String value) {
method length (line 198) | public int length() {
method getFieldName (line 205) | public String getFieldName(int index) {
method getValue (line 216) | public String getValue(int index) {
method get (line 227) | public String get(String fieldName) {
method getAll (line 239) | public RawHeaders getAll(Set<String> fieldNames) {
method toHeaderString (line 250) | public String toHeaderString() {
method toMultimap (line 265) | public Map<String, List<String>> toMultimap() {
method fromMultimap (line 290) | public static RawHeaders fromMultimap(Map<String, List<String>> map) {
method parse (line 304) | public static RawHeaders parse(String payload) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/cache/RequestHeaders.java
class RequestHeaders (line 30) | final class RequestHeaders {
method RequestHeaders (line 67) | public RequestHeaders(Uri uri, RawHeaders headers) {
method isChunked (line 126) | public boolean isChunked() {
method hasConnectionClose (line 130) | public boolean hasConnectionClose() {
method getUri (line 134) | public Uri getUri() {
method getHeaders (line 138) | public RawHeaders getHeaders() {
method isNoCache (line 142) | public boolean isNoCache() {
method getMaxAgeSeconds (line 146) | public int getMaxAgeSeconds() {
method getMaxStaleSeconds (line 150) | public int getMaxStaleSeconds() {
method getMinFreshSeconds (line 154) | public int getMinFreshSeconds() {
method isOnlyIfCached (line 158) | public boolean isOnlyIfCached() {
method hasAuthorization (line 162) | public boolean hasAuthorization() {
method getContentLength (line 166) | public int getContentLength() {
method getTransferEncoding (line 170) | public String getTransferEncoding() {
method getUserAgent (line 174) | public String getUserAgent() {
method getHost (line 178) | public String getHost() {
method getConnection (line 182) | public String getConnection() {
method getAcceptEncoding (line 186) | public String getAcceptEncoding() {
method getContentType (line 190) | public String getContentType() {
method getIfModifiedSince (line 194) | public String getIfModifiedSince() {
method getIfNoneMatch (line 198) | public String getIfNoneMatch() {
method getProxyAuthorization (line 202) | public String getProxyAuthorization() {
method setChunked (line 206) | public void setChunked() {
method setContentLength (line 214) | public void setContentLength(int contentLength) {
method setUserAgent (line 224) | public void setUserAgent(String userAgent) {
method setHost (line 232) | public void setHost(String host) {
method setConnection (line 240) | public void setConnection(String connection) {
method setAcceptEncoding (line 248) | public void setAcceptEncoding(String acceptEncoding) {
method setContentType (line 256) | public void setContentType(String contentType) {
method setIfModifiedSince (line 264) | public void setIfModifiedSince(Date date) {
method setIfNoneMatch (line 273) | public void setIfNoneMatch(String ifNoneMatch) {
method hasConditions (line 286) | public boolean hasConditions() {
method addCookies (line 290) | public void addCookies(Map<String, List<String>> allCookieHeaders) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/cache/ResponseCacheMiddleware.java
class ResponseCacheMiddleware (line 51) | public class ResponseCacheMiddleware extends SimpleMiddleware {
method ResponseCacheMiddleware (line 69) | private ResponseCacheMiddleware() {
method addCache (line 72) | public static ResponseCacheMiddleware addCache(AsyncHttpClient client,...
method getFileCache (line 84) | public FileCache getFileCache() {
method getCaching (line 88) | public boolean getCaching() {
method setCaching (line 92) | public void setCaching(boolean caching) {
method removeFromCache (line 96) | public void removeFromCache(Uri uri) {
method getSocket (line 103) | @Override
method getConditionalCacheHitCount (line 206) | public int getConditionalCacheHitCount() {
method getCacheHitCount (line 210) | public int getCacheHitCount() {
method getNetworkCount (line 214) | public int getNetworkCount() {
method getCacheStoreCount (line 218) | public int getCacheStoreCount() {
method onBodyDecoder (line 224) | @Override
method onResponseComplete (line 303) | @Override
method clear (line 322) | public void clear() {
class CacheData (line 328) | public static class CacheData {
class BodyCacher (line 335) | private static class BodyCacher extends FilteredDataEmitter {
method report (line 339) | @Override
method onDataAvailable (line 346) | @Override
method close (line 393) | @Override
method abort (line 399) | public void abort() {
method commit (line 406) | public void commit() {
class CachedBodyEmitter (line 414) | private static class CachedBodyEmitter extends FilteredDataEmitter {
method CachedBodyEmitter (line 420) | public CachedBodyEmitter(EntryCacheResponse cacheResponse, long cont...
method run (line 426) | @Override
method sendCachedDataOnNetworkThread (line 432) | void sendCachedDataOnNetworkThread() {
method sendCachedData (line 468) | void sendCachedData() {
method resume (line 472) | @Override
method isPaused (line 478) | @Override
method close (line 483) | @Override
method report (line 500) | @Override
class Entry (line 511) | private static final class Entry {
method Entry (line 566) | public Entry(InputStream in) throws IOException {
method Entry (line 603) | public Entry(Uri uri, RawHeaders varyHeaders, AsyncHttpRequest reque...
method writeTo (line 626) | public void writeTo(EntryEditor editor) throws IOException {
method isHttps (line 654) | private boolean isHttps() {
method readCertArray (line 658) | private Certificate[] readCertArray(StrictLineReader reader) throws ...
method writeCertArray (line 678) | private void writeCertArray(Writer writer, Certificate[] certificate...
method matches (line 695) | public boolean matches(Uri uri, String requestMethod,
class EntryCacheResponse (line 704) | static class EntryCacheResponse extends CacheResponse {
method EntryCacheResponse (line 708) | public EntryCacheResponse(Entry entry, FileInputStream snapshot) {
method getHeaders (line 713) | @Override
method getBody (line 718) | @Override
class CachedSSLSocket (line 724) | private class CachedSSLSocket extends CachedSocket implements AsyncSSL...
method CachedSSLSocket (line 725) | public CachedSSLSocket(EntryCacheResponse cacheResponse, long conten...
method getSSLEngine (line 729) | @Override
method getPeerCertificates (line 734) | @Override
class CachedSocket (line 740) | private class CachedSocket extends CachedBodyEmitter implements AsyncS...
method CachedSocket (line 744) | public CachedSocket(EntryCacheResponse cacheResponse, long contentLe...
method end (line 749) | @Override
method report (line 753) | @Override
method write (line 763) | @Override
method getWriteableCallback (line 769) | @Override
method setWriteableCallback (line 774) | @Override
method isOpen (line 778) | @Override
method close (line 783) | @Override
method getClosedCallback (line 788) | @Override
method setClosedCallback (line 793) | @Override
method getServer (line 798) | @Override
class EntryEditor (line 804) | class EntryEditor {
method EntryEditor (line 809) | public EntryEditor(String key) {
method commit (line 815) | void commit() {
method newOutputStream (line 824) | FileOutputStream newOutputStream(int index) throws IOException {
method abort (line 830) | void abort() {
FILE: androidasync/src/main/java/com/jeffmony/async/http/cache/ResponseHeaders.java
class ResponseHeaders (line 36) | final class ResponseHeaders {
method ResponseHeaders (line 117) | public ResponseHeaders(Uri uri, RawHeaders headers) {
method isContentEncodingGzip (line 190) | public boolean isContentEncodingGzip() {
method stripContentEncoding (line 194) | public void stripContentEncoding() {
method isChunked (line 199) | public boolean isChunked() {
method hasConnectionClose (line 203) | public boolean hasConnectionClose() {
method getUri (line 207) | public Uri getUri() {
method getHeaders (line 211) | public RawHeaders getHeaders() {
method getServedDate (line 215) | public Date getServedDate() {
method getLastModified (line 219) | public Date getLastModified() {
method getExpires (line 223) | public Date getExpires() {
method isNoCache (line 227) | public boolean isNoCache() {
method isNoStore (line 231) | public boolean isNoStore() {
method getMaxAgeSeconds (line 235) | public int getMaxAgeSeconds() {
method getSMaxAgeSeconds (line 239) | public int getSMaxAgeSeconds() {
method isPublic (line 243) | public boolean isPublic() {
method isMustRevalidate (line 247) | public boolean isMustRevalidate() {
method getEtag (line 251) | public String getEtag() {
method getVaryFields (line 255) | public Set<String> getVaryFields() {
method getContentEncoding (line 259) | public String getContentEncoding() {
method getContentLength (line 263) | public long getContentLength() {
method getConnection (line 267) | public String getConnection() {
method getProxyAuthenticate (line 271) | public String getProxyAuthenticate() {
method getWwwAuthenticate (line 275) | public String getWwwAuthenticate() {
method setLocalTimestamps (line 279) | public void setLocalTimestamps(long sentRequestMillis, long receivedRe...
method computeAge (line 290) | private long computeAge(long nowMillis) {
method computeFreshnessLifetime (line 306) | private long computeFreshnessLifetime() {
method isFreshnessLifetimeHeuristic (line 332) | private boolean isFreshnessLifetimeHeuristic() {
method isCacheable (line 340) | public boolean isCacheable(RequestHeaders request) {
method hasVaryAll (line 376) | public boolean hasVaryAll() {
method varyMatches (line 384) | public boolean varyMatches(Map<String, List<String>> cachedRequest,
method chooseResponseSource (line 397) | public ResponseSource chooseResponseSource(long nowMillis, RequestHead...
method validate (line 462) | public boolean validate(ResponseHeaders networkResponse) {
method combine (line 485) | public ResponseHeaders combine(ResponseHeaders network) {
method isEndToEnd (line 513) | private static boolean isEndToEnd(String fieldName) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/cache/ResponseSource.java
type ResponseSource (line 19) | enum ResponseSource {
method requiresConnection (line 37) | public boolean requiresConnection() {
FILE: androidasync/src/main/java/com/jeffmony/async/http/cache/StrictLineReader.java
class StrictLineReader (line 46) | class StrictLineReader implements Closeable {
method StrictLineReader (line 68) | public StrictLineReader(InputStream in) {
method StrictLineReader (line 80) | public StrictLineReader(InputStream in, int capacity) {
method StrictLineReader (line 93) | public StrictLineReader(InputStream in, Charset charset) {
method StrictLineReader (line 108) | public StrictLineReader(InputStream in, int capacity, Charset charset) {
method close (line 131) | @Override
method readLine (line 149) | public String readLine() throws IOException {
method readInt (line 206) | public int readInt() throws IOException {
method hasUnterminatedLine (line 221) | public boolean hasUnterminatedLine() {
method fillBuf (line 232) | private void fillBuf() throws IOException {
FILE: androidasync/src/main/java/com/jeffmony/async/http/callback/HttpConnectCallback.java
type HttpConnectCallback (line 5) | public interface HttpConnectCallback {
method onConnectCompleted (line 6) | void onConnectCompleted(Exception ex, AsyncHttpResponse response);
FILE: androidasync/src/main/java/com/jeffmony/async/http/callback/RequestCallback.java
type RequestCallback (line 6) | public interface RequestCallback<T> extends ResultCallback<AsyncHttpResp...
method onConnect (line 7) | void onConnect(AsyncHttpResponse response);
method onProgress (line 8) | void onProgress(AsyncHttpResponse response, long downloaded, long total);
FILE: androidasync/src/main/java/com/jeffmony/async/http/filter/ChunkedDataException.java
class ChunkedDataException (line 3) | public class ChunkedDataException extends Exception {
method ChunkedDataException (line 4) | public ChunkedDataException(String message) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/filter/ChunkedInputFilter.java
class ChunkedInputFilter (line 8) | public class ChunkedInputFilter extends FilteredDataEmitter {
type State (line 13) | private enum State {
method checkByte (line 24) | private boolean checkByte(char b, char value) {
method checkLF (line 33) | private boolean checkLF(char b) {
method checkCR (line 37) | private boolean checkCR(char b) {
method report (line 41) | @Override
method onDataAvailable (line 49) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/filter/ChunkedOutputFilter.java
class ChunkedOutputFilter (line 10) | public class ChunkedOutputFilter extends FilteredDataSink {
method ChunkedOutputFilter (line 11) | public ChunkedOutputFilter(DataSink sink) {
method filter (line 15) | @Override
method end (line 23) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/filter/ContentLengthFilter.java
class ContentLengthFilter (line 7) | public class ContentLengthFilter extends FilteredDataEmitter {
method ContentLengthFilter (line 8) | public ContentLengthFilter(long contentLength) {
method report (line 12) | @Override
method onDataAvailable (line 22) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/filter/DataRemainingException.java
class DataRemainingException (line 3) | public class DataRemainingException extends Exception {
method DataRemainingException (line 4) | public DataRemainingException(String message, Exception cause) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/filter/GZIPInputFilter.java
class GZIPInputFilter (line 16) | public class GZIPInputFilter extends InflaterInputFilter {
method peekShort (line 17) | static short peekShort(byte[] src, int offset, ByteOrder order) {
method GZIPInputFilter (line 35) | public GZIPInputFilter() {
method unsignedToBytes (line 42) | public static int unsignedToBytes(byte b) {
method onDataAvailable (line 46) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/filter/InflaterInputFilter.java
class InflaterInputFilter (line 11) | public class InflaterInputFilter extends FilteredDataEmitter {
method report (line 14) | @Override
method onDataAvailable (line 24) | @Override
method InflaterInputFilter (line 59) | public InflaterInputFilter() {
method InflaterInputFilter (line 63) | public InflaterInputFilter(Inflater inflater) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/filter/PrematureDataEndException.java
class PrematureDataEndException (line 3) | public class PrematureDataEndException extends Exception {
method PrematureDataEndException (line 4) | public PrematureDataEndException(String message) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/server/AsyncHttpRequestBodyProvider.java
type AsyncHttpRequestBodyProvider (line 6) | public interface AsyncHttpRequestBodyProvider {
method getBody (line 7) | AsyncHttpRequestBody getBody(Headers headers);
FILE: androidasync/src/main/java/com/jeffmony/async/http/server/AsyncHttpServer.java
class AsyncHttpServer (line 30) | @TargetApi(Build.VERSION_CODES.ECLAIR)
method stop (line 33) | public void stop() {
method onRequest (line 41) | protected boolean onRequest(AsyncHttpServerRequest request, AsyncHttpS...
method onResponseCompleted (line 45) | protected void onResponseCompleted(AsyncHttpServerRequest request, Asy...
method onRequest (line 49) | protected void onRequest(HttpServerRequestCallback callback, AsyncHttp...
method isKeepAlive (line 62) | protected boolean isKeepAlive(AsyncHttpServerRequest request, AsyncHtt...
method onUnknownBody (line 66) | protected AsyncHttpRequestBody onUnknownBody(Headers headers) {
method isSwitchingProtocols (line 70) | protected boolean isSwitchingProtocols(AsyncHttpServerResponse res) {
method onAccepted (line 75) | @Override
method onCompleted (line 260) | @Override
method onListening (line 265) | @Override
method listen (line 271) | public AsyncServerSocket listen(AsyncServer server, int port) {
method report (line 275) | private void report(Exception ex) {
method listen (line 280) | public AsyncServerSocket listen(int port) {
method listenSecure (line 284) | public void listenSecure(final int port, final SSLContext sslContext) {
method getListenCallback (line 310) | public ListenCallback getListenCallback() {
method setErrorCallback (line 315) | public void setErrorCallback(CompletedCallback callback) {
method getErrorCallback (line 319) | public CompletedCallback getErrorCallback() {
method getResponseCodeDescription (line 337) | public static String getResponseCodeDescription(int code) {
type WebSocketRequestCallback (line 344) | public static interface WebSocketRequestCallback {
method onConnected (line 345) | void onConnected(WebSocket webSocket, AsyncHttpServerRequest request);
FILE: androidasync/src/main/java/com/jeffmony/async/http/server/AsyncHttpServerRequest.java
type AsyncHttpServerRequest (line 12) | public interface AsyncHttpServerRequest extends DataEmitter {
method getHeaders (line 13) | Headers getHeaders();
method getMatcher (line 14) | Matcher getMatcher();
method setMatcher (line 15) | void setMatcher(Matcher matcher);
method getBody (line 16) | <T extends AsyncHttpRequestBody> T getBody();
method getSocket (line 17) | AsyncSocket getSocket();
method getPath (line 18) | String getPath();
method getQuery (line 19) | Multimap getQuery();
method getMethod (line 20) | String getMethod();
method getUrl (line 21) | String getUrl();
method get (line 23) | String get(String name);
method getState (line 24) | Map<String, Object> getState();
FILE: androidasync/src/main/java/com/jeffmony/async/http/server/AsyncHttpServerRequestImpl.java
class AsyncHttpServerRequestImpl (line 19) | public abstract class AsyncHttpServerRequestImpl extends FilteredDataEmi...
method getState (line 25) | @Override
method getStatusLine (line 30) | public String getStatusLine() {
method onCompleted (line 35) | @Override
method onCompleted (line 41) | @Override
method onHeadersReceived (line 48) | abstract protected void onHeadersReceived();
method onNotHttp (line 50) | protected void onNotHttp() {
method onUnknownBody (line 54) | protected AsyncHttpRequestBody onUnknownBody(Headers headers) {
method onBody (line 57) | protected AsyncHttpRequestBody onBody(Headers headers) {
method onStringAvailable (line 63) | @Override
method getMethod (line 96) | @Override
method setSocket (line 101) | void setSocket(AsyncSocket socket) {
method getSocket (line 110) | @Override
method getHeaders (line 115) | @Override
method setDataCallback (line 120) | @Override
method getDataCallback (line 125) | @Override
method isChunked (line 130) | @Override
method getBody (line 136) | @Override
method pause (line 141) | @Override
method resume (line 146) | @Override
method isPaused (line 151) | @Override
method toString (line 156) | @Override
method get (line 163) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/server/AsyncHttpServerResponse.java
type AsyncHttpServerResponse (line 18) | public interface AsyncHttpServerResponse extends DataSink, CompletedCall...
method end (line 19) | void end();
method send (line 20) | void send(String contentType, byte[] bytes);
method send (line 21) | void send(String contentType, ByteBufferList bb);
method send (line 22) | void send(String contentType, ByteBuffer bb);
method send (line 23) | void send(String contentType, String string);
method send (line 24) | void send(String string);
method send (line 25) | void send(JSONObject json);
method send (line 26) | void send(JSONArray jsonArray);
method sendFile (line 27) | void sendFile(File file);
method sendStream (line 28) | void sendStream(InputStream inputStream, long totalLength);
method sendBody (line 29) | <T> void sendBody(AsyncParser<T> body, T value);
method code (line 30) | AsyncHttpServerResponse code(int code);
method code (line 31) | int code();
method getHeaders (line 32) | Headers getHeaders();
method writeHead (line 33) | void writeHead();
method setContentType (line 34) | void setContentType(String contentType);
method redirect (line 35) | void redirect(String location);
method getRequest (line 36) | AsyncHttpServerRequest getRequest();
method getHttpVersion (line 37) | String getHttpVersion();
method setHttpVersion (line 38) | void setHttpVersion(String httpVersion);
method proxy (line 41) | void proxy(AsyncHttpResponse response);
method onCompleted (line 46) | void onCompleted(Exception ex);
method getSocket (line 47) | AsyncSocket getSocket();
method setSocket (line 48) | void setSocket(AsyncSocket socket);
FILE: androidasync/src/main/java/com/jeffmony/async/http/server/AsyncHttpServerResponseImpl.java
class AsyncHttpServerResponseImpl (line 34) | public class AsyncHttpServerResponseImpl implements AsyncHttpServerRespo...
method getHeaders (line 38) | @Override
method getSocket (line 43) | public AsyncSocket getSocket() {
method setSocket (line 47) | @Override
method AsyncHttpServerResponseImpl (line 54) | AsyncHttpServerResponseImpl(AsyncSocket socket, AsyncHttpServerRequest...
method getRequest (line 61) | @Override
method write (line 66) | @Override
method initFirstWrite (line 88) | void initFirstWrite() {
method setWriteableCallback (line 148) | @Override
method getWriteableCallback (line 156) | @Override
method end (line 164) | @Override
method writeHead (line 196) | @Override
method setContentType (line 201) | @Override
method send (line 206) | @Override
method sendBody (line 211) | @Override
method send (line 217) | @Override
method send (line 222) | @Override
method send (line 234) | @Override
method onEnd (line 245) | protected void onEnd() {
method report (line 249) | protected void report(Exception e) {
method send (line 253) | @Override
method send (line 261) | @Override
method send (line 266) | @Override
method sendStream (line 271) | @Override
method sendFile (line 336) | @Override
method proxy (line 350) | @Override
method code (line 367) | @Override
method code (line 373) | @Override
method redirect (line 378) | @Override
method getHttpVersion (line 386) | @Override
method setHttpVersion (line 391) | @Override
method onCompleted (line 396) | @Override
method isOpen (line 401) | @Override
method setClosedCallback (line 409) | @Override
method getClosedCallback (line 417) | @Override
method getServer (line 424) | @Override
method toString (line 429) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/server/AsyncHttpServerRouter.java
class AsyncHttpServerRouter (line 33) | public class AsyncHttpServerRouter implements RouteMatcher {
class RouteInfo (line 35) | private static class RouteInfo {
method removeAction (line 44) | public void removeAction(String action, String regex) {
method addAction (line 54) | public void addAction(String action, String regex, HttpServerRequestCa...
method addAction (line 66) | public void addAction(String action, String regex, HttpServerRequestCa...
method websocket (line 70) | public void websocket(String regex, final AsyncHttpServer.WebSocketReq...
method checkWebSocketUpgrade (line 74) | static public WebSocket checkWebSocketUpgrade(final String protocol, A...
method websocket (line 96) | public void websocket(String regex, final String protocol, final Async...
method get (line 109) | public void get(String regex, HttpServerRequestCallback callback) {
method post (line 113) | public void post(String regex, HttpServerRequestCallback callback) {
class Asset (line 117) | public static class Asset {
method Asset (line 118) | public Asset(int available, InputStream inputStream, String path) {
method getAssetStream (line 129) | public static Asset getAssetStream(final Context context, String asset) {
method getAssetStream (line 133) | public static Asset getAssetStream(AssetManager am, String asset) {
method getContentType (line 167) | public static String getContentType(String path) {
method tryGetContentType (line 171) | public static String tryGetContentType(String path) {
method ensureManifest (line 183) | static synchronized Manifest ensureManifest(Context context) {
method isClientCached (line 207) | static boolean isClientCached(Context context, AsyncHttpServerRequest ...
method directory (line 228) | public void directory(Context context, String regex, final String asse...
method directory (line 279) | public void directory(String regex, final File directory) {
method directory (line 283) | public void directory(String regex, final File directory, final boolea...
class RouteMatch (line 344) | public static class RouteMatch {
method RouteMatch (line 351) | private RouteMatch(String method, String path, Matcher matcher, Http...
class AsyncHttpServerRequestImpl (line 360) | abstract class AsyncHttpServerRequestImpl extends com.jeffmony.async.h...
method getMatcher (line 362) | @Override
method setMatcher (line 367) | @Override
class Callback (line 373) | class Callback implements HttpServerRequestCallback, RouteMatcher {
method onRequest (line 374) | @Override
method route (line 386) | @Override
method getCallback (line 394) | public HttpServerRequestCallback getCallback() {
method route (line 398) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/server/AsyncProxyServer.java
class AsyncProxyServer (line 14) | public class AsyncProxyServer extends AsyncHttpServer {
method AsyncProxyServer (line 16) | public AsyncProxyServer(AsyncServer server) {
method onRequest (line 20) | @Override
method onRequest (line 66) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/server/BoundaryEmitter.java
class BoundaryEmitter (line 9) | public class BoundaryEmitter extends FilteredDataEmitter {
method setBoundary (line 11) | public void setBoundary(String boundary) {
method getBoundary (line 15) | public String getBoundary() {
method getBoundaryStart (line 21) | public String getBoundaryStart() {
method getBoundaryEnd (line 26) | public String getBoundaryEnd() {
method onBoundaryStart (line 31) | protected void onBoundaryStart() {
method onBoundaryEnd (line 34) | protected void onBoundaryEnd() {
method onDataAvailable (line 72) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/http/server/HttpServerRequestCallback.java
type HttpServerRequestCallback (line 4) | public interface HttpServerRequestCallback {
method onRequest (line 5) | void onRequest(AsyncHttpServerRequest request, AsyncHttpServerResponse...
FILE: androidasync/src/main/java/com/jeffmony/async/http/server/MalformedRangeException.java
class MalformedRangeException (line 3) | public class MalformedRangeException extends Exception {
FILE: androidasync/src/main/java/com/jeffmony/async/http/server/MimeEncodingException.java
class MimeEncodingException (line 3) | public class MimeEncodingException extends Exception {
method MimeEncodingException (line 4) | public MimeEncodingException(String message) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/server/RouteMatcher.java
type RouteMatcher (line 3) | public interface RouteMatcher {
method route (line 4) | AsyncHttpServerRouter.RouteMatch route(String method, String path);
FILE: androidasync/src/main/java/com/jeffmony/async/http/server/StreamSkipException.java
class StreamSkipException (line 3) | public class StreamSkipException extends Exception {
method StreamSkipException (line 4) | public StreamSkipException(String message) {
FILE: androidasync/src/main/java/com/jeffmony/async/http/server/UnknownRequestBody.java
class UnknownRequestBody (line 11) | public class UnknownRequestBody implements AsyncHttpRequestBody<Void> {
method UnknownRequestBody (line 12) | public UnknownRequestBody(String contentType) {
method UnknownRequestBody (line 17) | public UnknownRequestBody(DataEmitter emitter, String contentType, int...
method write (line 23) | @Override
method getContentType (line 31) | @Override
method readFullyOnRequest (line 36) | @Override
method length (line 41) | @Override
method get (line 46) | @Override
method setCallbacks (line 51) | @Deprecated
method getEmitter (line 57) | public DataEmitter getEmitter() {
method parse (line 62) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/parser/AsyncParser.java
type AsyncParser (line 13) | public interface AsyncParser<T> {
method parse (line 14) | Future<T> parse(DataEmitter emitter);
method write (line 15) | void write(DataSink sink, T value, CompletedCallback completed);
method getType (line 16) | Type getType();
method getMime (line 17) | String getMime();
FILE: androidasync/src/main/java/com/jeffmony/async/parser/ByteBufferListParser.java
class ByteBufferListParser (line 17) | public class ByteBufferListParser implements AsyncParser<ByteBufferList> {
method parse (line 18) | @Override
method write (line 54) | @Override
method getType (line 59) | @Override
method getMime (line 64) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/parser/DocumentParser.java
class DocumentParser (line 19) | public class DocumentParser implements AsyncParser<Document> {
method parse (line 20) | @Override
method write (line 26) | @Override
method getType (line 31) | @Override
method getMime (line 36) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/parser/JSONArrayParser.java
class JSONArrayParser (line 15) | public class JSONArrayParser implements AsyncParser<JSONArray> {
method parse (line 16) | @Override
method write (line 22) | @Override
method getType (line 27) | @Override
method getMime (line 32) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/parser/JSONObjectParser.java
class JSONObjectParser (line 15) | public class JSONObjectParser implements AsyncParser<JSONObject> {
method parse (line 16) | @Override
method write (line 21) | @Override
method getType (line 26) | @Override
method getMime (line 31) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/parser/StringParser.java
class StringParser (line 15) | public class StringParser implements AsyncParser<String> {
method StringParser (line 18) | public StringParser() {
method StringParser (line 21) | public StringParser(Charset charset) {
method parse (line 25) | @Override
method write (line 37) | @Override
method getType (line 42) | @Override
method getMime (line 47) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/stream/ByteBufferListInputStream.java
class ByteBufferListInputStream (line 11) | public class ByteBufferListInputStream extends InputStream {
method ByteBufferListInputStream (line 13) | public ByteBufferListInputStream(ByteBufferList bb) {
method read (line 17) | @Override
method read (line 24) | @Override
method read (line 29) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/stream/FileDataSink.java
class FileDataSink (line 13) | public class FileDataSink extends OutputStreamDataSink {
method FileDataSink (line 15) | public FileDataSink(AsyncServer server, File file) {
method getOutputStream (line 20) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/stream/InputStreamDataEmitter.java
class InputStreamDataEmitter (line 16) | public class InputStreamDataEmitter implements DataEmitter {
method InputStreamDataEmitter (line 19) | public InputStreamDataEmitter(AsyncServer server, InputStream inputStr...
method setDataCallback (line 26) | @Override
method getDataCallback (line 31) | @Override
method isChunked (line 36) | @Override
method pause (line 42) | @Override
method resume (line 47) | @Override
method report (line 53) | private void report(final Exception e) {
method run (line 73) | @Override
method doResume (line 112) | private void doResume() {
method isPaused (line 116) | @Override
method setEndCallback (line 122) | @Override
method getEndCallback (line 127) | @Override
method getServer (line 132) | @Override
method close (line 137) | @Override
method charset (line 147) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/stream/OutputStreamDataCallback.java
class OutputStreamDataCallback (line 12) | public class OutputStreamDataCallback implements DataCallback, Completed...
method OutputStreamDataCallback (line 14) | public OutputStreamDataCallback(OutputStream os) {
method getOutputStream (line 18) | public OutputStream getOutputStream() {
method onDataAvailable (line 22) | @Override
method close (line 39) | public void close() {
method onCompleted (line 48) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/stream/OutputStreamDataSink.java
class OutputStreamDataSink (line 13) | public class OutputStreamDataSink implements DataSink {
method OutputStreamDataSink (line 14) | public OutputStreamDataSink(AsyncServer server) {
method end (line 18) | @Override
method OutputStreamDataSink (line 31) | public OutputStreamDataSink(AsyncServer server, OutputStream stream) {
method setOutputStream (line 37) | public void setOutputStream(OutputStream stream) {
method getOutputStream (line 41) | public OutputStream getOutputStream() throws IOException {
method write (line 45) | @Override
method setWriteableCallback (line 63) | @Override
method getWriteableCallback (line 68) | @Override
method isOpen (line 73) | @Override
method reportClose (line 80) | public void reportClose(Exception ex) {
method setClosedCallback (line 91) | @Override
method getClosedCallback (line 96) | @Override
method getServer (line 101) | @Override
method setOutputStreamWritableCallback (line 107) | public void setOutputStreamWritableCallback(WritableCallback outputStr...
FILE: androidasync/src/main/java/com/jeffmony/async/util/Allocator.java
class Allocator (line 10) | public class Allocator {
method Allocator (line 15) | public Allocator(int maxAlloc) {
method Allocator (line 19) | public Allocator() {
method allocate (line 23) | public ByteBuffer allocate() {
method allocate (line 27) | public ByteBuffer allocate(int currentAlloc) {
method track (line 31) | public void track(long read) {
method getMaxAlloc (line 35) | public int getMaxAlloc() {
method setCurrentAlloc (line 39) | public void setCurrentAlloc(int currentAlloc) {
method getMinAlloc (line 43) | public int getMinAlloc() {
method setMinAlloc (line 47) | public Allocator setMinAlloc(int minAlloc ) {
FILE: androidasync/src/main/java/com/jeffmony/async/util/ArrayDeque.java
class ArrayDeque (line 59) | public class ArrayDeque<E> extends AbstractCollection<E>
method allocateElements (line 100) | private void allocateElements(int numElements) {
method doubleCapacity (line 123) | private void doubleCapacity() {
method copyElements (line 146) | private <T> T[] copyElements(T[] a) {
method ArrayDeque (line 161) | public ArrayDeque() {
method ArrayDeque (line 171) | public ArrayDeque(int numElements) {
method ArrayDeque (line 185) | public ArrayDeque(Collection<? extends E> c) {
method addFirst (line 200) | public void addFirst(E e) {
method addLast (line 216) | public void addLast(E e) {
method offerFirst (line 231) | public boolean offerFirst(E e) {
method offerLast (line 243) | public boolean offerLast(E e) {
method removeFirst (line 251) | public E removeFirst() {
method removeLast (line 261) | public E removeLast() {
method pollFirst (line 268) | public E pollFirst() {
method pollLast (line 279) | public E pollLast() {
method getFirst (line 292) | public E getFirst() {
method getLast (line 302) | public E getLast() {
method peekFirst (line 310) | public E peekFirst() {
method peekLast (line 316) | public E peekLast() {
method removeFirstOccurrence (line 334) | public boolean removeFirstOccurrence(Object o) {
method removeLastOccurrence (line 362) | public boolean removeLastOccurrence(Object o) {
method add (line 389) | public boolean add(E e) {
method offer (line 403) | public boolean offer(E e) {
method remove (line 418) | public E remove() {
method poll (line 432) | public E poll() {
method element (line 446) | public E element() {
method peek (line 459) | public E peek() {
method push (line 474) | public void push(E e) {
method pop (line 488) | public E pop() {
method checkInvariants (line 492) | private void checkInvariants() {
method delete (line 510) | private boolean delete(int i) {
method size (line 556) | public int size() {
method isEmpty (line 565) | public boolean isEmpty() {
method iterator (line 577) | public Iterator<E> iterator() {
method descendingIterator (line 581) | public Iterator<E> descendingIterator() {
class DeqIterator (line 585) | private class DeqIterator implements Iterator<E> {
method hasNext (line 603) | public boolean hasNext() {
method next (line 607) | public E next() {
method remove (line 620) | public void remove() {
class DescendingIterator (line 631) | private class DescendingIterator implements Iterator<E> {
method hasNext (line 641) | public boolean hasNext() {
method next (line 645) | public E next() {
method remove (line 656) | public void remove() {
method contains (line 675) | public boolean contains(Object o) {
method remove (line 702) | public boolean remove(Object o) {
method clear (line 710) | public void clear() {
method toArray (line 737) | public Object[] toArray() {
method toArray (line 777) | @SuppressWarnings("unchecked")
method clone (line 796) | public ArrayDeque<E> clone() {
method writeObject (line 820) | private void writeObject(java.io.ObjectOutputStream s)
method readObject (line 836) | private void readObject(java.io.ObjectInputStream s)
FILE: androidasync/src/main/java/com/jeffmony/async/util/Charsets.java
class Charsets (line 6) | public class Charsets {
FILE: androidasync/src/main/java/com/jeffmony/async/util/Deque.java
type Deque (line 168) | public interface Deque<E> extends Queue<E> {
method addFirst (line 185) | void addFirst(E e);
method addLast (line 205) | void addLast(E e);
method offerFirst (line 223) | boolean offerFirst(E e);
method offerLast (line 241) | boolean offerLast(E e);
method removeFirst (line 251) | E removeFirst();
method removeLast (line 261) | E removeLast();
method pollFirst (line 269) | E pollFirst();
method pollLast (line 277) | E pollLast();
method getFirst (line 288) | E getFirst();
method getLast (line 298) | E getLast();
method peekFirst (line 306) | E peekFirst();
method peekLast (line 314) | E peekLast();
method removeFirstOccurrence (line 332) | boolean removeFirstOccurrence(Object o);
method removeLastOccurrence (line 350) | boolean removeLastOccurrence(Object o);
method add (line 376) | boolean add(E e);
method offer (line 399) | boolean offer(E e);
method remove (line 412) | E remove();
method poll (line 424) | E poll();
method element (line 437) | E element();
method peek (line 449) | E peek();
method push (line 473) | void push(E e);
method pop (line 485) | E pop();
method remove (line 508) | boolean remove(Object o);
method contains (line 523) | boolean contains(Object o);
method size (line 530) | public int size();
method iterator (line 538) | Iterator<E> iterator();
method descendingIterator (line 548) | Iterator<E> descendingIterator();
FILE: androidasync/src/main/java/com/jeffmony/async/util/FileCache.java
class FileCache (line 21) | public class FileCache {
class CacheEntry (line 22) | class CacheEntry {
method CacheEntry (line 24) | public CacheEntry(File file) {
class Snapshot (line 29) | public static class Snapshot {
method Snapshot (line 32) | Snapshot(FileInputStream[] fins, long[] lens) {
method getLength (line 37) | public long getLength(int index) {
method close (line 41) | public void close() {
method findAlternativeMessageDigest (line 48) | private static MessageDigest findAlternativeMessageDigest() {
method toKeyString (line 81) | public static synchronized String toKeyString(Object... parts) {
method getTempFile (line 92) | public File getTempFile() {
method getTempFiles (line 98) | public File[] getTempFiles(int count) {
method removeFiles (line 106) | public static void removeFiles(File... files) {
method remove (line 114) | public void remove(String key) {
method exists (line 122) | public boolean exists(String key, int part) {
method exists (line 126) | public boolean exists(String key) {
method touch (line 130) | public File touch(File file) {
method get (line 136) | public FileInputStream get(String key) throws IOException {
method getFile (line 140) | public File getFile(String key) {
method get (line 144) | public FileInputStream[] get(String key, int count) throws IOException {
method getPartName (line 163) | String getPartName(String key, int part) {
method commitTempFiles (line 167) | public void commitTempFiles(String key, File... tempFiles) {
method removePartFiles (line 185) | void removePartFiles(String key) {
method getPartFile (line 194) | File getPartFile(String key, int part) {
method setBlockSize (line 199) | public void setBlockSize(long blockSize) {
class InternalCache (line 203) | class InternalCache extends LruCache<String, CacheEntry> {
method InternalCache (line 204) | public InternalCache() {
method sizeOf (line 208) | @Override
method entryRemoved (line 213) | @Override
method compare (line 229) | @Override
method load (line 242) | void load() {
method doLoad (line 264) | private void doLoad() {
method FileCache (line 278) | public FileCache(File directory, long size, boolean loadAsync) {
method size (line 288) | public long size() {
method clear (line 292) | public void clear() {
method keySet (line 297) | public Set<String> keySet() {
method setMaxSize (line 311) | public void setMaxSize(long maxSize) {
FILE: androidasync/src/main/java/com/jeffmony/async/util/FileUtility.java
class FileUtility (line 8) | public class FileUtility {
method deleteDirectory (line 9) | static public boolean deleteDirectory(File path) {
FILE: androidasync/src/main/java/com/jeffmony/async/util/HashList.java
class HashList (line 10) | public class HashList<T> {
method HashList (line 13) | public HashList() {
method keySet (line 16) | public Set<String> keySet() {
method tag (line 20) | public synchronized <V> V tag(String key) {
method tag (line 27) | public synchronized <V> void tag(String key, V tag) {
method remove (line 36) | public synchronized ArrayList<T> remove(String key) {
method size (line 40) | public synchronized int size() {
method get (line 44) | public synchronized ArrayList<T> get(String key) {
method contains (line 48) | synchronized public boolean contains(String key) {
method add (line 53) | synchronized public void add(String key, T value) {
method pop (line 63) | synchronized public T pop(String key) {
method removeItem (line 72) | synchronized public boolean removeItem(String key, T value) {
FILE: androidasync/src/main/java/com/jeffmony/async/util/IdleTimeout.java
class IdleTimeout (line 7) | public class IdleTimeout extends TimeoutBase {
method IdleTimeout (line 10) | public IdleTimeout(AsyncServer server, long delay) {
method IdleTimeout (line 15) | public IdleTimeout(Handler handler, long delay) {
method setTimeout (line 19) | public void setTimeout(Runnable callback) {
method reset (line 24) | public void reset() {
method cancel (line 29) | public void cancel() {
FILE: androidasync/src/main/java/com/jeffmony/async/util/LruCache.java
class LruCache (line 30) | public class LruCache<K, V> {
method LruCache (line 48) | public LruCache(long maxSize) {
method get (line 62) | public final V get(K key) {
method put (line 116) | public final V put(K key, V value) {
method trimToSize (line 143) | private void trimToSize(long maxSize) {
method remove (line 174) | public final V remove(K key) {
method entryRemoved (line 209) | protected void entryRemoved(boolean evicted, K key, V oldValue, V newV...
method create (line 226) | protected V create(K key) {
method safeSizeOf (line 230) | private long safeSizeOf(K key, V value) {
method sizeOf (line 245) | protected long sizeOf(K key, V value) {
method evictAll (line 252) | public final void evictAll() {
method size (line 261) | public synchronized final long size() {
method setMaxSize (line 265) | public void setMaxSize(long maxSize) {
method maxSize (line 274) | public synchronized final long maxSize() {
method hitCount (line 281) | public synchronized final int hitCount() {
method missCount (line 289) | public synchronized final int missCount() {
method createCount (line 296) | public synchronized final int createCount() {
method putCount (line 303) | public synchronized final int putCount() {
method evictionCount (line 310) | public synchronized final int evictionCount() {
method snapshot (line 318) | public synchronized final Map<K, V> snapshot() {
method toString (line 322) | @Override
FILE: androidasync/src/main/java/com/jeffmony/async/util/StreamUtility.java
class StreamUtility (line 18) | public class StreamUtility {
method fastChannelCopy (line 19) | public static void fastChannelCopy(final ReadableByteChannel src, fina...
method copyStream (line 38) | public static void copyStream(InputStream input, OutputStream output) ...
method readToEndAsArray (line 46) | public static byte[] readToEndAsArray(InputStream input) throws IOExce...
method readToEnd (line 60) | public static String readToEnd(InputStream input) throws IOException
method readFile (line 65) | static public String readFile(String filename) throws IOException {
method readFileSilent (line 69) | static public String readFileSilent(String filename) {
method readFile (line 78) | static public String readFile(File file) throws IOException {
method writeFile (line 90) | public static void writeFile(File file, String string) throws IOExcept...
method writeFile (line 97) | public static void writeFile(String file, String string) throws IOExce...
method closeQuietly (line 101) | public static void closeQuietly(Closeable... closeables) {
method eat (line 118) | public static void eat(InputStream input) throws IOException {
FILE: androidasync/src/main/java/com/jeffmony/async/util/TaggedList.java
class TaggedList (line 5) | public class TaggedList<T> extends ArrayList<T> {
method tag (line 8) | public synchronized <V> V tag() {
method tag (line 12) | public synchronized <V> void tag(V tag) {
method tagNull (line 16) | public synchronized <V> void tagNull(V tag) {
FILE: androidasync/src/main/java/com/jeffmony/async/util/ThrottleTimeout.java
class ThrottleTimeout (line 14) | public class ThrottleTimeout<T> extends TimeoutBase {
type ThrottleMode (line 19) | public enum ThrottleMode {
method ThrottleTimeout (line 33) | public ThrottleTimeout(final AsyncServer server, long delay, ValueCall...
method ThrottleTimeout (line 38) | public ThrottleTimeout(final Handler handler, long delay, ValueCallbac...
method setCallback (line 43) | public void setCallback(ValueCallback<List<T>> callback) {
method runCallback (line 47) | private void runCallback() {
method postThrottled (line 55) | public synchronized void postThrottled(final T value) {
method setThrottleMode (line 76) | public void setThrottleMode(ThrottleMode throttleMode) {
FILE: androidasync/src/main/java/com/jeffmony/async/util/TimeoutBase.java
class TimeoutBase (line 8) | public class TimeoutBase {
type Handlerish (line 12) | interface Handlerish {
method post (line 13) | void post(Runnable r);
method postDelayed (line 14) | Object postDelayed(Runnable r, long delay);
method removeAllCallbacks (line 15) | void removeAllCallbacks(Object cancellable);
method onCallback (line 18) | protected void onCallback() {
method TimeoutBase (line 22) | public TimeoutBase(final AsyncServer server, long delay) {
method TimeoutBase (line 44) | public TimeoutBase(final Handler handler, long delay) {
method setDelay (line 67) | public void setDelay(long delay) {
FILE: androidasync/src/main/java/com/jeffmony/async/util/UntypedHashtable.java
class UntypedHashtable (line 5) | public class UntypedHashtable {
method put (line 8) | public void put(String key, Object value) {
method remove (line 12) | public void remove(String key) {
method get (line 16) | public <T> T get(String key, T defaultValue) {
method get (line 23) | public <T> T get(String key) {
FILE: androidasync/src/main/java/com/jeffmony/async/wrapper/AsyncSocketWrapper.java
type AsyncSocketWrapper (line 5) | public interface AsyncSocketWrapper extends AsyncSocket, DataEmitterWrap...
method getSocket (line 6) | AsyncSocket getSocket();
FILE: androidasync/src/main/java/com/jeffmony/async/wrapper/DataEmitterWrapper.java
type DataEmitterWrapper (line 5) | public interface DataEmitterWrapper extends DataEmitter {
method getDataEmitter (line 6) | DataEmitter getDataEmitter();
FILE: app/src/main/java/com/android/media/DownloadBaseListActivity.java
class DownloadBaseListActivity (line 20) | public class DownloadBaseListActivity extends AppCompatActivity {
method onCreate (line 30) | @Override
method initViews (line 40) | private void initViews() {
method initDatas (line 48) | private void initDatas() {
method onDownloadDefault (line 111) | @Override
method onDownloadPending (line 117) | @Override
method onDownloadPrepare (line 123) | @Override
method onDownloadStart (line 129) | @Override
method onDownloadProxyReady (line 135) | @Override
method onDownloadProgress (line 140) | @Override
method onDownloadSpeed (line 146) | @Override
method onDownloadPause (line 151) | @Override
method onDownloadError (line 157) | @Override
method onDownloadProxyForbidden (line 163) | @Override
method onDownloadSuccess (line 169) | @Override
method notifyChanged (line 176) | private void notifyChanged(VideoTaskItem item) {
method onDestroy (line 185) | @Override
FILE: app/src/main/java/com/android/media/DownloadFeatureActivity.java
class DownloadFeatureActivity (line 11) | public class DownloadFeatureActivity extends AppCompatActivity implement...
method onCreate (line 18) | @Override
method initViews (line 26) | private void initViews() {
method onClick (line 38) | @Override
FILE: app/src/main/java/com/android/media/DownloadOrcodeActivity.java
class DownloadOrcodeActivity (line 11) | public class DownloadOrcodeActivity extends AppCompatActivity implements...
method onCreate (line 17) | @Override
method initViews (line 25) | private void initViews() {
method onClick (line 34) | @Override
FILE: app/src/main/java/com/android/media/DownloadPlayActivity.java
class DownloadPlayActivity (line 32) | public class DownloadPlayActivity extends AppCompatActivity implements V...
method onCreate (line 51) | @Override
method initViews (line 64) | private void initViews() {
method onSurfaceTextureAvailable (line 76) | @Override
method onSurfaceTextureSizeChanged (line 82) | @Override
method onSurfaceTextureDestroyed (line 87) | @Override
method onSurfaceTextureUpdated (line 92) | @Override
method initPlayer (line 98) | private void initPlayer() {
method onPrepared (line 122) | @Override
method onError (line 129) | @Override
method onVideoSizeChanged (line 137) | @Override
method onClick (line 151) | @Override
method onPause (line 165) | @Override
method onDestroy (line 174) | @Override
method doPlayVideo (line 180) | private void doPlayVideo() {
method doReleasePlayer (line 190) | private void doReleasePlayer() {
method handleMessage (line 203) | @Override
method updateProgressView (line 211) | private void updateProgressView() {
method onProgressChanged (line 223) | @Override
method onStartTrackingTouch (line 227) | @Override
method onStopTrackingTouch (line 235) | @Override
method onCacheReady (line 250) | @Override
method onCacheProgressChanged (line 255) | @Override
method onCacheSpeedChanged (line 260) | @Override
method onCacheForbidden (line 265) | @Override
method onCacheFinished (line 270) | @Override
FILE: app/src/main/java/com/android/media/DownloadSettingsActivity.java
class DownloadSettingsActivity (line 21) | public class DownloadSettingsActivity
method handleMessage (line 41) | @Override
method onCreate (line 54) | @Override
method initViews (line 61) | private void initViews() {
method onResume (line 87) | @Override
method onClick (line 96) | @Override
method checkBtnState (line 133) | private void checkBtnState(int type) {
method onStop (line 168) | @Override
FILE: app/src/main/java/com/android/media/MainActivity.java
class MainActivity (line 11) | public class MainActivity extends AppCompatActivity implements View.OnCl...
method onCreate (line 17) | @Override
method onClick (line 30) | @Override
FILE: app/src/main/java/com/android/media/MediaScannerActivity.java
class MediaScannerActivity (line 8) | public class MediaScannerActivity extends AppCompatActivity {
method onCreate (line 10) | @Override
FILE: app/src/main/java/com/android/media/MyApplication.java
class MyApplication (line 12) | public class MyApplication extends Application {
method onCreate (line 14) | @Override
FILE: app/src/main/java/com/android/media/PlayFeatureActivity.java
class PlayFeatureActivity (line 41) | public class PlayFeatureActivity extends AppCompatActivity implements Vi...
method onCreate (line 61) | @Override
method initViews (line 70) | private void initViews() {
method initViewListData (line 92) | private void initViewListData() {
method onResume (line 144) | @Override
method checkPermission (line 152) | private void checkPermission() {
method onRequestPermissionsResult (line 159) | @Override
method onClick (line 170) | @Override
method onCheckedChanged (line 179) | @Override
method doPlayVideo (line 184) | private void doPlayVideo() {
method clearVideoCache (line 206) | private void clearVideoCache() {
FILE: app/src/main/java/com/android/media/PlayerActivity.java
class PlayerActivity (line 30) | public class PlayerActivity extends AppCompatActivity implements View.On...
method onCreate (line 53) | @Override
method initViews (line 69) | private void initViews() {
method initPlayer (line 81) | private void initPlayer() {
method onSurfaceTextureAvailable (line 114) | @Override
method onSurfaceTextureSizeChanged (line 120) | @Override
method onSurfaceTextureDestroyed (line 125) | @Override
method onSurfaceTextureUpdated (line 130) | @Override
method onProgressChanged (line 137) | @Override
method onStartTrackingTouch (line 141) | @Override
method onStopTrackingTouch (line 149) | @Override
method onPause (line 163) | @Override
method onStop (line 172) | @Override
method onDestroy (line 177) | @Override
method onPrepared (line 185) | @Override
method onError (line 192) | @Override
method onVideoSizeChanged (line 200) | @Override
method onCacheReady (line 220) | @Override
method onCacheProgressChanged (line 237) | @Override
method onCacheSpeedChanged (line 244) | @Override
method onCacheForbidden (line 248) | @Override
method onCacheFinished (line 253) | @Override
method handleMessage (line 264) | @Override
method onClick (line 272) | @Override
method doPlayVideo (line 286) | private void doPlayVideo() {
method updateProgressView (line 297) | private void updateProgressView() {
method doReleasePlayer (line 308) | private void doReleasePlayer() {
FILE: app/src/main/java/com/android/media/VideoListAdapter.java
class VideoListAdapter (line 18) | public class VideoListAdapter extends ArrayAdapter<VideoTaskItem> {
method VideoListAdapter (line 22) | public VideoListAdapter(Context context, int resource, VideoTaskItem[]...
method getView (line 27) | @NonNull
method setStateText (line 52) | private void setStateText(TextView stateView, TextView playBtn, VideoT...
method setDownloadInfoText (line 95) | private void setDownloadInfoText(TextView infoView, VideoTaskItem item) {
method notifyChanged (line 111) | public void notifyChanged(VideoTaskItem[] items, VideoTaskItem item) {
FILE: base/src/main/java/com/android/baselib/MediaSDKReceiver.java
class MediaSDKReceiver (line 10) | public class MediaSDKReceiver extends BroadcastReceiver {
method onReceive (line 12) | @Override
FILE: base/src/main/java/com/android/baselib/NetworkCallbackImpl.java
class NetworkCallbackImpl (line 12) | @SuppressLint("NewApi")
method NetworkCallbackImpl (line 17) | public NetworkCallbackImpl(NetworkListener listener) {
method onAvailable (line 21) | @Override
method onCapabilitiesChanged (line 26) | @Override
method onLost (line 38) | @Override
method onUnavailable (line 42) | @Override
FILE: base/src/main/java/com/android/baselib/NetworkListener.java
type NetworkListener (line 3) | public interface NetworkListener {
method onAvailable (line 5) | void onAvailable();
method onWifiConnected (line 7) | void onWifiConnected();
method onMobileConnected (line 9) | void onMobileConnected();
method onNetworkType (line 11) | void onNetworkType();
method onUnConnected (line 13) | void onUnConnected();
FILE: base/src/main/java/com/android/baselib/WeakHandler.java
class WeakHandler (line 30) | @SuppressWarnings("unused")
method WeakHandler (line 46) | public WeakHandler() {
method WeakHandler (line 61) | public WeakHandler(@Nullable Handler.Callback callback) {
method WeakHandler (line 71) | public WeakHandler(@NonNull Looper looper) {
method WeakHandler (line 83) | public WeakHandler(@NonNull Looper looper, @NonNull Handler.Callback c...
method post (line 99) | public final boolean post(@NonNull Runnable r) {
method postAtTime (line 120) | public final boolean postAtTime(@NonNull Runnable r, long uptimeMillis) {
method postAtTime (line 143) | public final boolean postAtTime(Runnable r, Object token, long uptimeM...
method postDelayed (line 164) | public final boolean postDelayed(Runnable r, long delayMillis) {
method postAtFrontOfQueue (line 183) | public final boolean postAtFrontOfQueue(Runnable r) {
method removeCallbacks (line 190) | public final void removeCallbacks(Runnable r) {
method removeCallbacks (line 202) | public final void removeCallbacks(Runnable r, Object token) {
method sendMessage (line 218) | public final boolean sendMessage(Message msg) {
method sendEmptyMessage (line 229) | public final boolean sendEmptyMessage(int what) {
method sendEmptyMessageDelayed (line 242) | public final boolean sendEmptyMessageDelayed(int what, long delayMilli...
method sendEmptyMessageAtTime (line 255) | public final boolean sendEmptyMessageAtTime(int what, long uptimeMilli...
method sendMessageDelayed (line 271) | public final boolean sendMessageDelayed(Message msg, long delayMillis) {
method sendMessageAtTime (line 293) | public boolean sendMessageAtTime(Message msg, long uptimeMillis) {
method sendMessageAtFrontOfQueue (line 309) | public final boolean sendMessageAtFrontOfQueue(Message msg) {
method removeMessages (line 317) | public final void removeMessages(int what) {
method removeMessages (line 326) | public final void removeMessages(int what, Object object) {
method removeCallbacksAndMessages (line 335) | public final void removeCallbacksAndMessages(Object token) {
method hasMessages (line 343) | public final boolean hasMessages(int what) {
method hasMessages (line 351) | public final boolean hasMessages(int what, Object object) {
method getLooper (line 355) | public final Looper getLooper() {
method wrapRunnable (line 359) | private WeakRunnable wrapRunnable(@NonNull Runnable r) {
class ExecHandler (line 369) | private static class ExecHandler extends Handler {
method ExecHandler (line 372) | ExecHandler() {
method ExecHandler (line 376) | ExecHandler(WeakReference<Callback> callback) {
method ExecHandler (line 380) | ExecHandler(Looper looper) {
method ExecHandler (line 385) | ExecHandler(Looper looper, WeakReference<Callback> callback) {
method handleMessage (line 390) | @Override
class WeakRunnable (line 403) | static class WeakRunnable implements Runnable {
method WeakRunnable (line 407) | WeakRunnable(WeakReference<Runnable> delegate, WeakReference<Chained...
method run (line 412) | @Override
class ChainedRef (line 425) | static class ChainedRef {
method ChainedRef (line 438) | public ChainedRef(@NonNull Lock lock, @NonNull Runnable r) {
method remove (line 444) | public WeakRunnable remove() {
method insertAfter (line 461) | public void insertAfter(@NonNull ChainedRef candidate) {
method remove (line 476) | @Nullable
FILE: base/src/main/java/com/android/baselib/utils/LogUtils.java
class LogUtils (line 5) | public class LogUtils {
method e (line 13) | public static void e(String msg) {
method i (line 19) | public static void i(String msg) {
method d (line 25) | public static void d(String msg) {
method w (line 31) | public static void w(String msg) {
FILE: base/src/main/java/com/android/baselib/utils/NetworkUtils.java
class NetworkUtils (line 8) | public class NetworkUtils {
method isNetworkConnected (line 16) | @SuppressWarnings({"MissingPermission"})
method isWifiConnected (line 28) | @SuppressWarnings({"MissingPermission"})
method isMobileConnected (line 40) | @SuppressWarnings({"MissingPermission"})
method getAPNType (line 52) | @SuppressWarnings({"MissingPermission"})
method getNetworkType (line 86) | public static String getNetworkType(Context context) {
FILE: base/src/main/java/com/android/baselib/utils/ScreenUtils.java
class ScreenUtils (line 6) | public class ScreenUtils {
method getScreenWidth (line 8) | public static int getScreenWidth(Context context) {
method getScreenHeight (line 13) | public static int getScreenHeight(Context context) {
FILE: base/src/main/java/com/android/baselib/utils/Utility.java
class Utility (line 7) | public class Utility {
method getSize (line 9) | public static String getSize(long size) {
method getPercent (line 31) | public static String getPercent(float percent) {
method getTime (line 36) | public static String getTime(long time) {
method getVideoTimeString (line 42) | public static String getVideoTimeString(long duration) {
method getTimeShow (line 54) | public static String getTimeShow(long timeMillis) {
FILE: exoplayer/src/main/java/com/google/android/exoplayer2/AudioBecomingNoisyManager.java
class AudioBecomingNoisyManager (line 25) | final class AudioBecomingNoisyManager {
type EventListener (line 31) | public interface EventListener {
method onAudioBecomingNoisy (line 32) | void onAudioBecomingNoisy();
method AudioBecomingNoisyManager (line 35) | public AudioBecomingNoisyManager(Context context, Handler eventHandler...
method setEnabled (line 47) | public void setEnabled(boolean enabled) {
class AudioBecomingNoisyReceiver (line 58) | private final class AudioBecomingNoisyReceiver extends BroadcastReceiv...
method AudioBecomingNoisyReceiver (line 62) | public AudioBecomingNoisyReceiver(Handler eventHandler, EventListene...
method onReceive (line 67) | @Override
method run (line 74) | @Override
FILE: exoplayer/src/main/java/com/google/android/exoplayer2/AudioFocusManager.java
class AudioFocusManager (line 37) | final class AudioFocusManager {
type PlayerControl (line 40) | public interface PlayerControl {
method setVolumeMultiplier (line 46) | void setVolumeMultiplier(float volumeMultiplier);
method executePlayerCommand (line 53) | void executePlayerCommand(@PlayerCommand int playerCommand);
method AudioFocusManager (line 121) | public AudioFocusManager(Context context, Handler eventHandler, Player...
method getVolumeMultiplier (line 130) | public float getVolumeMultiplier() {
method setAudioAttributes (line 143) | @PlayerCommand
method handlePrepare (line 170) | @PlayerCommand
method handleSetPlayWhenReady (line 182) | @PlayerCommand
method handleStop (line 193) | public void handleStop() {
method getFocusListener (line 199) | @VisibleForTesting
method handleIdle (line 204) | @PlayerCommand
method requestAudioFocus (line 209) | @PlayerCommand
method abandonAudioFocus (line 241) | private void abandonAudioFocus() {
method abandonAudioFocus (line 245) | private void abandonAudioFocus(boolean forceAbandon) {
method requestAudioFocusDefault (line 262) | private int requestAudioFocusDefault() {
method requestAudioFocusV26 (line 269) | @RequiresApi(26)
method abandonAudioFocusDefault (line 290) | private void abandonAudioFocusDefault() {
method abandonAudioFocusV26 (line 294) | @RequiresApi(26)
method willPauseWhenDucked (line 301) | private boolean willPauseWhenDucked() {
method convertAudioAttributesToFocusGain (line 313) | @C.AudioFocusGain
method handleAudioFocusChange (line 385) | private void handleAudioFocusChange(int focusChange) {
class AudioFocusListener (line 444) | private class AudioFocusListener implements AudioManager.OnAudioFocusC...
method AudioFocusListener (line 447) | public AudioFocusListener(Handler eventHandler) {
method onAudioFocusChange (line 451) | @Override
FILE: exoplayer/src/main/java/com/google/android/exoplayer2/BasePlayer.java
class BasePlayer (line 22) | public abstract class BasePlayer implements Player {
method BasePlayer (line 26) | public BasePlayer() {
method isPlaying (line 30) | @Override
method seekToDefaultPosition (line 37) | @Override
method seekToDefaultPosition (line 42) | @Override
method seekTo (line 47) | @Override
method hasPrevious (line 52) | @Override
method previous (line 57) | @Override
method hasNext (line 65) | @Override
method next (line 70) | @Override
method stop (line 78) | @Override
method getNextWindowIndex (line 83) | @Override
method getPreviousWindowIndex (line 92) | @Override
method getCurrentTag (line 101) | @Override
method getCurrentManifest (line 108) | @Override
method getBufferedPercentage (line 115) | @Override
method isCurrentWindowDynamic (line 124) | @Override
method isCurrentWindowLive (line 130) | @Override
method isCurrentWindowSeekable (line 136) | @Override
method getContentDuration (line 142) | @Override
method getRepeatModeForNavigation (line 150) | @RepeatMode
class ListenerHolder (line 157) | protected static final class ListenerHolder {
method ListenerHolder (line 167) | public ListenerHolder(EventListener listener) {
method release (line 172) | public void release() {
method invoke (line 180) | public void invoke(ListenerInvocation listenerInvocation) {
method equals (line 186) | @Override
method hashCode (line 197) | @Override
type ListenerInvocation (line 204) | protected interface ListenerInvocation {
method invokeListener (line 207) | void invokeListener(EventListener listener);
FILE: exoplayer/src/main/java/com/google/android/exoplayer2/BaseRenderer.java
class BaseRenderer (line 34) | public abstract class BaseRenderer implements Renderer, RendererCapabili...
method BaseRenderer (line 53) | public BaseRenderer(int trackType) {
method getTrackType (line 59) | @Override
method getCapabilities (line 64) | @Override
method setIndex (line 69) | @Override
method getMediaClock (line 74) | @Override
method getState (line 80) | @Override
method enable (line 85) | @Override
method start (line 97) | @Override
method replaceStream (line 104) | @Override
method getStream (line 115) | @Override
method hasReadStreamToEnd (line 121) | @Override
method getReadingPositionUs (line 126) | @Override
method setCurrentStreamFinal (line 131) | @Override
method isCurrentStreamFinal (line 136) | @Override
method maybeThrowStreamError (line 141) | @Override
method resetPosition (line 146) | @Override
method stop (line 153) | @Override
method disable (line 160) | @Override
method reset (line 171) | @Override
method supportsMixedMimeTypeAdaptation (line 180) | @Override
method handleMessage (line 188) | @Override
method onEnabled (line 203) | protected void onEnabled(boolean joining) throws ExoPlaybackException {
method onStreamChanged (line 220) | protected void onStreamChanged(Format[] formats, long offsetUs) throws...
method onPositionReset (line 238) | protected void onPositionReset(long positionUs, boolean joining) throw...
method onStarted (line 249) | protected void onStarted() throws ExoPlaybackException {
method onStopped (line 260) | protected void onStopped() throws ExoPlaybackException {
method onDisabled (line 269) | protected void onDisabled() {
method onReset (line 278) | protected void onReset() {
method getFormatHolder (line 285) | protected final FormatHolder getFormatHolder() {
method getStreamFormats (line 291) | protected final Format[] getStreamFormats() {
method getConfiguration (line 298) | protected final RendererConfiguration getConfiguration() {
method getUpdatedSourceDrmSession (line 303) | @Nullable
method getIndex (line 334) | protected final int getIndex() {
method createRendererException (line 345) | protected final ExoPlaybackException createRendererException(
method readSource (line 377) | protected final int readSource(
method skipSource (line 404) | protected int skipSource(long positionUs) {
method isSourceReady (line 411) | protected final boolean isSourceReady() {
method supportsFormatDrm (line 424) | protected static boolean supportsFormatDrm(@Nullable DrmSessionManager...
FILE: exoplayer/src/main/java/com/google/android/exoplayer2/C.java
class C (line 42) | @SuppressWarnings("InlinedApi")
method C (line 45) | private C() {}
method usToMs (line 1101) | public static long usToMs(long timeUs) {
method msToUs (line 1112) | public static long msToUs(long timeMs) {
method generateAudioSessionIdV21 (line 1122) | @TargetApi(21)
FILE: exoplayer/src/main/java/com/google/android/exoplayer2/ControlDispatcher.java
type ControlDispatcher (line 27) | public interface ControlDispatcher {
method dispatchSetPlayWhenReady (line 36) | boolean dispatchSetPlayWhenReady(Player player, boolean playWhenReady);
method dispatchSeekTo (line 47) | boolean dispatchSeekTo(Player player, int windowIndex, long positionMs);
method dispatchSetRepeatMode (line 56) | boolean dispatchSetRepeatMode(Player player, @RepeatMode int repeatMode);
method dispatchSetShuffleModeEnabled (line 65) | boolean dispatchSetShuffleModeEnabled(Player player, boolean shuffleMo...
method dispatchStop (line 74) | boolean dispatchStop(Player player, boolean reset);
FILE: exoplayer/src/main/java/com/google/android/exoplayer2/DefaultControlDispatcher.java
class DefaultControlDispatcher (line 24) | public class DefaultControlDispatcher implements ControlDispatcher {
method dispatchSetPlayWhenReady (line 26) | @Override
method dispatchSeekTo (line 32) | @Override
method dispatchSetRepeatMode (line 38) | @Override
method dispatchSetShuffleModeEnabled (line 44) | @Override
method dispatchStop (line 50) | @Override
FILE: exoplayer/src/main/java/com/google/android/exoplayer2/DefaultLoadControl.java
class DefaultLoadControl (line 28) | public class DefaultLoadControl implements LoadControl {
class Builder (line 90) | public static final class Builder {
method Builder (line 105) | public Builder() {
method setAllocator (line 124) | public Builder setAllocator(DefaultAllocator allocator) {
method setBufferDurationsMs (line 145) | public Builder setBufferDurationsMs(
method setTargetBufferBytes (line 177) | public Builder setTargetBufferBytes(int targetBufferBytes) {
method setPrioritizeTimeOverSizeThresholds (line 192) | public Builder setPrioritizeTimeOverSizeThresholds(boolean prioritiz...
method setBackBuffer (line 208) | public Builder setBackBuffer(int backBufferDurationMs, boolean retai...
method createDefaultLoadControl (line 217) | public DefaultLoadControl createDefaultLoadControl() {
method DefaultLoadControl (line 254) | @SuppressWarnings("deprecation")
method DefaultLoadControl (line 260) | @Deprecated
method DefaultLoadControl (line 276) | @Deprecated
method DefaultLoadControl (line 298) | protected DefaultLoadControl(
method onPrepared (line 342) | @Override
method onTracksSelected (line 347) | @Override
method onStopped (line 358) | @Override
method onReleased (line 363) | @Override
method getAllocator (line 368) | @Override
method getBackBufferDurationUs (line 373) | @Override
method retainBackBufferFromKeyframe (line 378) | @Override
method shouldContinueLoading (line 383) | @Override
method shouldStartPlayback (line 402) | @Override
method calculateTargetBufferSize (line 421) | protected int calculateTargetBufferSize(
method reset (line 432) | private void reset(boolean resetAllocator) {
method getDefaultBufferSize (line 440) | private static int getDefaultBufferSize(int trackType) {
method hasVideo (line 461) | private static boolean hasVideo(Renderer[] renderers, TrackSelectionAr...
method assertGreaterOrEqual (line 470) | private static void assertGreaterOrEqual(int value1, int value2, Strin...
FILE: exoplayer/src/main/java/com/google/android/exoplayer2/DefaultMediaClock.java
class DefaultMediaClock (line 27) | final class DefaultMediaClock implements MediaClock {
type PlaybackParameterListener (line 32) | public interface PlaybackParameterListener {
method onPlaybackParametersChanged (line 40) | void onPlaybackParametersChanged(PlaybackParameters newPlaybackParam...
method DefaultMediaClock (line 59) | public DefaultMediaClock(PlaybackParameterListener listener, Clock clo...
method start (line 68) | public void start() {
method stop (line 76) | public void stop() {
method resetPosition (line 86) | public void resetPosition(long positionUs) {
method onRendererEnabled (line 98) | public void onRendererEnabled(Renderer renderer) throws ExoPlaybackExc...
method onRendererDisabled (line 117) | public void onRendererDisabled(Renderer renderer) {
method syncAndGetPositionUs (line 130) | public long syncAndGetPositionUs(boolean isReadingAhead) {
method getPositionUs (line 137) | @Override
method setPlaybackParameters (line 142) | @Override
method getPlaybackParameters (line 151) | @Override
method syncClocks (line 158) | private void syncClocks(boolean isReadingAhead) {
method shouldUseStandaloneClock (line 187) | private boolean shouldUseStandaloneClock(boolean isReadingAhead) {
FILE: exoplayer/src/main/java/com/google/android/exoplayer2/DefaultRenderersFactory.java
class DefaultRenderersFactory (line 50) | public class DefaultRenderersFactory implements RenderersFactory {
method DefaultRenderersFactory (line 98) | public DefaultRenderersFactory(Context context) {
method DefaultRenderersFactory (line 109) | @Deprecated
method DefaultRenderersFactory (line 120) | @Deprecated
method DefaultRenderersFactory (line 132) | @Deprecated
method DefaultRenderersFactory (line 145) | @Deprecated
method DefaultRenderersFactory (line 159) | @Deprecated
method setExtensionRendererMode (line 182) | public DefaultRenderersFactory setExtensionRendererMode(
method setPlayClearSamplesWithoutKeys (line 201) | public DefaultRenderersFactory setPlayClearSamplesWithoutKeys(
method setEnableDecoderFallback (line 215) | public DefaultRenderersFactory setEnableDecoderFallback(boolean enable...
method setMediaCodecSelector (line 228) | public DefaultRenderersFactory setMediaCodecSelector(MediaCodecSelecto...
method setAllowedVideoJoiningTimeMs (line 243) | public DefaultRenderersFactory setAllowedVideoJoiningTimeMs(long allow...
method createRenderers (line 248) | @Override
method buildVideoRenderers (line 311) | protected void buildVideoRenderers(
method buildAudioRenderers (line 417) | protected void buildAudioRenderers(
method buildTextRenderers (line 521) | protected void buildTextRenderers(
method buildMetadataRenderers (line 539) | protected void buildMetadataRenderers(
method buildCameraMotionRenderers (line 555) | protected void buildCameraMotionRenderers(
method buildMiscellaneousRenderers (line 568) | protected void buildMiscellaneousRenderers(Context context, Handler ev...
method buildAudioProcessors (line 576) | protected AudioProcessor[] buildAudioProcessors() {
FILE: exoplayer/src/main/java/com/google/android/exoplayer2/ExoPlaybackException.java
class ExoPlaybackException (line 32) | public final class ExoPlaybackException extends Exception {
method createForSource (line 102) | public static ExoPlaybackException createForSource(IOException cause) {
method createForRenderer (line 117) | public static ExoPlaybackException createForRenderer(
method createForUnexpected (line 136) | public static ExoPlaybackException createForUnexpected(RuntimeExceptio...
method createForRemote (line 146) | public static ExoPlaybackException createForRemote(String message) {
method createForOutOfMemoryError (line 156) | public static ExoPlaybackException createForOutOfMemoryError(OutOfMemo...
method ExoPlaybackException (line 160) | private ExoPlaybackException(@Type int type, Throwable cause) {
method ExoPlaybackException (line 169) | private ExoPlaybackException(
method ExoPlaybackException (line 184) | private ExoPlaybackException(@Type int type, String message) {
method getSourceException (line 199) | public IOException getSourceException() {
method getRendererException (line 209) | public Exception getRendererException() {
method getUnexpectedException (line 219) | public RuntimeException getUnexpectedException() {
method getOutOfMemoryError (line 229) | public OutOfMemoryError getOutOfMemoryError() {
FILE: exoplayer/src/main/java/com/google/android/exoplayer2/ExoPlayer.java
type ExoPlayer (line 126) | public interface ExoPlayer extends Player {
class Builder (line 133) | final class Builder {
method Builder (line 166) | public Builder(Context context, Renderer... renderers) {
method Builder (line 194) | public Builder(
method setTrackSelector (line 221) | public Builder setTrackSelector(TrackSelector trackSelector) {
method setLoadControl (line 234) | public Builder setLoadControl(LoadControl loadControl) {
method setBandwidthMeter (line 247) | public Builder setBandwidthMeter(BandwidthMeter bandwidthMeter) {
method setLooper (line 261) | public Builder setLooper(Looper looper) {
method setAnalyticsCollector (line 274) | public Builder setAnalyticsCollector(AnalyticsCollector analyticsCol...
method setUseLazyPreparation (line 291) | public Builder setUseLazyPreparation(boolean useLazyPreparation) {
method setClock (line 305) | @VisibleForTesting
method build (line 317) | public ExoPlayer build() {
method getPlaybackLooper (line 326) | Looper getPlaybackLooper();
method retry (line 332) | void retry();
method prepare (line 338) | void prepare(MediaSource mediaSource);
method prepare (line 352) | void prepare(MediaSource mediaSource, boolean resetPosition, boolean r...
method createMessage (line 363) | PlayerMessage createMessage(PlayerMessage.Target target);
method setSeekParameters (line 370) | void setSeekParameters(@Nullable SeekParameters seekParameters);
method getSeekParameters (line 373) | SeekParameters getSeekParameters();
method setForegroundMode (line 403) | void setForegroundMode(boolean foregroundMode);
FILE: exoplayer/src/main/java/com/google/android/exoplayer2/ExoPlayerFactory.java
class ExoPlayerFactory (line 33) | @Deprecated
method ExoPlayerFactory (line 36) | private ExoPlayerFactory() {}
method newSimpleInstance (line 43) | @Deprecated
method newSimpleInstance (line 62) | @Deprecated
method newSimpleInstance (line 80) | @Deprecated
method newSimpleInstance (line 87) | @Deprecated
method newSimpleInstance (line 94) | @Deprecated
method newSimpleInstance (line 102) | @Deprecated
method newSimpleInstance (line 115) | @Deprecated
method newSimpleInstance (line 132) | @Deprecated
method newSimpleInstance (line 144) | @Deprecated
method newSimpleInstance (line 165) | @Deprecated
method newSimpleInstance (line 182) | @Deprecated
method newSimpleInstance (line 207) | @Deprecated
method newSimpleInstance (line 231) | @Deprecated
method newSimpleInstance (line 255) | @Deprecated
method newSimpleInstance (line 281) | @SuppressWarnings("deprecation")
method newInstance (line 305) | @Deprecated
method newInstance (line 313) | @Deprecated
method newInstance (line 321) | @Deprecated
method newInstance (line 339) | @Deprecated
FILE: exoplayer/src/main/java/com/google/android/exoplayer2/ExoPlayerImpl.java
class ExoPlayerImpl (line 43) | final class ExoPlayerImpl extends BasePlayer implements ExoPlayer {
method ExoPlayerImpl (line 97) | @SuppressLint("HandlerLeak")
method getAudioComponent (line 147) | @Override
method getVideoComponent (line 153) | @Override
method getTextComponent (line 159) | @Override
method getMetadataComponent (line 165) | @Override
method getPlaybackLooper (line 171) | @Override
method getApplicationLooper (line 176) | @Override
method addListener (line 181) | @Override
method removeListener (line 186) | @Override
method getPlaybackState (line 196) | @Override
method getPlaybackSuppressionReason (line 202) | @Override
method getPlaybackError (line 208) | @Override
method retry (line 214) | @Override
method prepare (line 221) | @Override
method prepare (line 226) | @Override
method setPlayWhenReady (line 251) | @Override
method setPlayWhenReady (line 256) | public void setPlayWhenReady(
method getPlayWhenReady (line 289) | @Override
method setRepeatMode (line 294) | @Override
method getRepeatMode (line 303) | @Override
method setShuffleModeEnabled (line 308) | @Override
method getShuffleModeEnabled (line 317) | @Override
method isLoading (line 322) | @Override
method seekTo (line 327) | @Override
method setPlaybackParameters (line 365) | @Override
method getPlaybackParameters (line 380) | @Override
method setSeekParameters (line 385) | @Override
method getSeekParameters (line 396) | @Override
method setForegroundMode (line 401) | @Override
method stop (line 409) | @Override
method release (line 434) | @Override
method createMessage (line 450) | @Override
method getCurrentPeriodIndex (line 460) | @Override
method getCurrentWindowIndex (line 469) | @Override
method getDuration (line 479) | @Override
method getCurrentPosition (line 490) | @Override
method getBufferedPosition (line 501) | @Override
method getTotalBufferedDuration (line 511) | @Override
method isPlayingAd (line 516) | @Override
method getCurrentAdGroupIndex (line 521) | @Override
method getCurrentAdIndexInAdGroup (line 526) | @Override
method getContentPosition (line 531) | @Override
method getContentBufferedPosition (line 543) | @Override
method getRendererCount (line 566) | @Override
method getRendererType (line 571) | @Override
method getCurrentTrackGroups (line 576) | @Override
method getCurrentTrackSelections (line 581) | @Override
method getCurrentTimeline (line 586) | @Override
method handleEvent (line 592) | void handleEvent(Message msg) {
method handlePlaybackParameters (line 609) | private void handlePlaybackParameters(
method handlePlaybackInfo (line 622) | private void handlePlaybackInfo(
method getResetPlaybackInfo (line 661) | private PlaybackInfo getResetPlaybackInfo(
method updatePlaybackInfo (line 699) | private void updatePlaybackInfo(
method notifyListeners (line 724) | private void notifyListeners(ListenerInvocation listenerInvocation) {
method notifyListeners (line 729) | private void notifyListeners(Runnable listenerNotificationRunnable) {
method periodPositionUsToWindowPositionMs (line 741) | private long periodPositionUsToWindowPositionMs(MediaPeriodId periodId...
method shouldMaskPosition (line 748) | private boolean shouldMaskPosition() {
class PlaybackInfoUpdate (line 752) | private static final class PlaybackInfoUpdate implements Runnable {
method PlaybackInfoUpdate (line 769) | public PlaybackInfoUpdate(
method run (line 799) | @Override
method invokeAll (line 842) | private static void invokeAll(
FILE: exoplayer/src/main/java/com/google/android/exoplayer2/ExoPlayerImplInternal.java
class ExoPlayerImplInternal (line 50) | final class ExoPlayerImplInternal
method ExoPlayerImplInternal (line 126) | public ExoPlayerImplInternal(
method prepare (line 177) | public void prepare(MediaSource mediaSource, boolean resetPosition, bo...
method setPlayWhenReady (line 183) | public void setPlayWhenReady(boolean playWhenReady) {
method setRepeatMode (line 187) | public void setRepeatMode(@Player.RepeatMode int repeatMode) {
method setShuffleModeEnabled (line 191) | public void setShuffleModeEnabled(boolean shuffleModeEnabled) {
method seekTo (line 195) | public void seekTo(Timeline timeline, int windowIndex, long positionUs) {
method setPlaybackParameters (line 201) | public void setPlaybackParameters(PlaybackParameters playbackParameter...
method setSeekParameters (line 205) | public void setSeekParameters(SeekParameters seekParameters) {
method stop (line 209) | public void stop(boolean reset) {
method sendMessage (line 213) | @Override
method setForegroundMode (line 223) | public synchronized void setForegroundMode(boolean foregroundMode) {
method release (line 249) | public synchronized void release() {
method getPlaybackLooper (line 268) | public Looper getPlaybackLooper() {
method onSourceInfoRefreshed (line 274) | @Override
method onPrepared (line 283) | @Override
method onContinueLoadingRequested (line 288) | @Override
method onTrackSelectionsInvalidated (line 295) | @Override
method onPlaybackParametersChanged (line 302) | @Override
method handleMessage (line 309) | @Override
method getExoPlaybackExceptionMessage (line 414) | private String getExoPlaybackExceptionMessage(ExoPlaybackException e) {
method setState (line 428) | private void setState(int state) {
method maybeNotifyPlaybackInfoChanged (line 434) | private void maybeNotifyPlaybackInfoChanged() {
method prepareInternal (line 449) | private void prepareInternal(MediaSource mediaSource, boolean resetPos...
method setPlayWhenReadyInternal (line 464) | private void setPlayWhenReadyInternal(boolean playWhenReady) throws Ex...
method setRepeatModeInternal (line 480) | private void setRepeatModeInternal(@Player.RepeatMode int repeatMode)
method setShuffleModeEnabledInternal (line 489) | private void setShuffleModeEnabledInternal(boolean shuffleModeEnabled)
method seekToCurrentPosition (line 498) | private void seekToCurrentPosition(boolean sendDiscontinuity) throws E...
method startRenderers (line 512) | private void startRenderers() throws ExoPlaybackException {
method stopRenderers (line 520) | private void stopRenderers() throws ExoPlaybackException {
method updatePlaybackPositions (line 527) | private void updatePlaybackPositions() throws ExoPlaybackException {
method doSomeWork (line 563) | private void doSomeWork() throws ExoPlaybackException, IOException {
method scheduleNextWork (line 661) | private void scheduleNextWork(long thisOperationStartTimeMs, long inte...
method seekToInternal (line 666) | private void seekToInternal(SeekPosition seekPosition) throws ExoPlayb...
method seekToPeriodPosition (line 739) | private long seekToPeriodPosition(MediaPeriodId periodId, long periodP...
method seekToPeriodPosition (line 746) | private long seekToPeriodPosition(
method resetRendererPosition (line 805) | private void resetRendererPosition(long periodPositionUs) throws ExoPl...
method setPlaybackParametersInternal (line 818) | private void setPlaybackParametersInternal(PlaybackParameters playback...
method setSeekParametersInternal (line 824) | private void setSeekParametersInternal(SeekParameters seekParameters) {
method setForegroundModeInternal (line 828) | private void setForegroundModeInternal(
method stopInternal (line 848) | private void stopInternal(
method releaseInternal (line 863) | private void releaseInternal() {
method resetInternal (line 879) | private void resetInternal(
method sendMessageInternal (line 963) | private void sendMessageInternal(PlayerMessage message) throws ExoPlay...
method sendMessageToTarget (line 982) | private void sendMessageToTarget(PlayerMessage message) throws ExoPlay...
method sendMessageToTargetThread (line 995) | private void sendMessageToTargetThread(final PlayerMessage message) {
method deliverMessage (line 1013) | private void deliverMessage(PlayerMessage message) throws ExoPlaybackE...
method resolvePendingMessagePositions (line 1024) | private void resolvePendingMessagePositions() {
method resolvePendingMessagePosition (line 1036) | private boolean resolvePendingMessagePosition(PendingMessageInfo pendi...
method maybeTriggerPendingMessages (line 1064) | private void maybeTriggerPendingMessages(long oldPeriodPositionUs, lon...
method ensureStopped (line 1127) | private void ensureStopped(Renderer renderer) throws ExoPlaybackExcept...
method disableRenderer (line 1133) | private void disableRenderer(Renderer renderer) throws ExoPlaybackExce...
method reselectTracksInternal (line 1139) | private void reselectTracksInternal() throws ExoPlaybackException {
method updateTrackSelectionPlaybackSpeed (line 1222) | private void updateTrackSelectionPlaybackSpeed(float playbackSpeed) {
method notifyTrackSelectionDiscontinuity (line 1235) | private void notifyTrackSelectionDiscontinuity() {
method shouldTransitionToReadyState (line 1248) | private boolean shouldTransitionToReadyState(boolean renderersReadyOrE...
method isTimelineReady (line 1269) | private boolean isTimelineReady() {
method maybeThrowSourceInfoRefreshError (line 1277) | private void maybeThrowSourceInfoRefreshError() throws IOException {
method handleSourceInfoRefreshed (line 1290) | private void handleSourceInfoRefreshed(MediaSourceRefreshInfo sourceRe...
method getMaxRendererReadPositionUs (line 1384) | private long getMaxRendererReadPositionUs() {
method handleSourceInfoRefreshEndedPlayback (line 1409) | private void handleSourceInfoRefreshEndedPlayback() {
method resolveSubsequentPeriod (line 1432) | private @Nullable Object resolveSubsequentPeriod(
method resolveSeekPosition (line 1461) | @Nullable
method getPeriodPosition (line 1513) | private Pair<Object, Long> getPeriodPosition(
method updatePeriods (line 1518) | private void updatePeriods() throws ExoPlaybackException, IOException {
method maybeUpdateLoadingPeriod (line 1533) | private void maybeUpdateLoadingPeriod() throws ExoPlaybackException, I...
method maybeUpdateReadingPeriod (line 1563) | private void maybeUpdateReadingPeriod() throws ExoPlaybackException {
method maybeUpdatePlayingPeriod (line 1641) | private void maybeUpdatePlayingPeriod() throws ExoPlaybackException {
method shouldAdvancePlayingPeriod (line 1671) | private boolean shouldAdvancePlayingPeriod() {
method hasReadingPeriodFinishedReading (line 1690) | private boolean hasReadingPeriodFinishedReading() {
method setAllRendererStreamsFinal (line 1707) | private void setAllRendererStreamsFinal() {
method handlePeriodPrepared (line 1715) | private void handlePeriodPrepared(MediaPeriod mediaPeriod) throws ExoP...
method handleContinueLoadingRequested (line 1733) | private void handleContinueLoadingRequested(MediaPeriod mediaPeriod) {
method handlePlaybackParameters (line 1742) | private void handlePlaybackParameters(
method maybeContinueLoading (line 1757) | private void maybeContinueLoading() {
method shouldContinueLoading (line 1765) | private boolean shouldContinueLoading() {
method isLoadingPossible (line 1775) | private boolean isLoadingPossible() {
method updateIsLoading (line 1787) | private void updateIsLoading() {
method copyWithNewPosition (line 1796) | private PlaybackInfo copyWithNewPosition(
method updatePlayingPeriodRenderers (line 1803) | @SuppressWarnings("ParameterNotNullable")
method enableRenderers (line 1835) | private void enableRenderers(boolean[] rendererWasEnabledFlags, int to...
method enableRenderer (line 1855) | private void enableRenderer(
method handleLoadingMediaPeriodChanged (line 1887) | private void handleLoadingMediaPeriodChanged(boolean loadingTrackSelec...
Condensed preview — 946 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (7,186K chars).
[
{
"path": ".gitignore",
"chars": 220,
"preview": "build\n.gradle\n.idea\nlocal.properties\napp/app.iml\nplayerlib/playerlib.iml\nexoplayerlib/exoplayerlib.iml\nijkplayerlib/ijkp"
},
{
"path": "LICENSE",
"chars": 11348,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 3784,
"preview": "# MediaSDK\n\nThe library is working for downloading video while playing the video, the video contains M3U8/MP4 <br>\n\nDeve"
},
{
"path": "README_cn.md",
"chars": 5150,
"preview": "# MediaSDK\n\n关注一下分析文章:https://www.jianshu.com/p/27085da32a35\n\n```\nallprojects {\n repositories {\n ...\n maven { url "
},
{
"path": "androidasync/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "androidasync/androidasync.iml",
"chars": 10624,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<module external.linked.project.id=\":androidasync\" external.linked.project.path=\""
},
{
"path": "androidasync/build.gradle",
"chars": 907,
"preview": "apply plugin: 'com.android.library'\n\nandroid {\n compileSdkVersion 29\n buildToolsVersion \"29.0.3\"\n\n defaultConfi"
},
{
"path": "androidasync/consumer-rules.pro",
"chars": 0,
"preview": ""
},
{
"path": "androidasync/proguard-rules.pro",
"chars": 751,
"preview": "# Add project specific ProGuard rules here.\n# You can control the set of applied configuration files using the\n# proguar"
},
{
"path": "androidasync/src/main/AndroidManifest.xml",
"chars": 105,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"com.jeffmony.async\" />\n"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/AsyncDatagramSocket.java",
"chars": 2088,
"preview": "package com.jeffmony.async;\n\nimport java.io.IOException;\nimport java.net.InetSocketAddress;\nimport java.nio.ByteBuffer;\n"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/AsyncNetworkSocket.java",
"chars": 9298,
"preview": "package com.jeffmony.async;\n\nimport android.util.Log;\n\n\nimport com.jeffmony.async.callback.CompletedCallback;\nimport com"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/AsyncSSLException.java",
"chars": 396,
"preview": "package com.jeffmony.async;\n\npublic class AsyncSSLException extends Exception {\n public AsyncSSLException(Throwable c"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/AsyncSSLServerSocket.java",
"chars": 236,
"preview": "package com.jeffmony.async;\n\nimport java.security.PrivateKey;\nimport java.security.cert.Certificate;\n\npublic interface A"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/AsyncSSLSocket.java",
"chars": 237,
"preview": "package com.jeffmony.async;\n\nimport java.security.cert.X509Certificate;\n\nimport javax.net.ssl.SSLEngine;\n\npublic interfa"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/AsyncSSLSocketWrapper.java",
"chars": 30289,
"preview": "package com.jeffmony.async;\n\nimport android.content.Context;\nimport android.os.Build;\nimport android.util.Base64;\nimport"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/AsyncSemaphore.java",
"chars": 2640,
"preview": "package com.jeffmony.async;\n\nimport java.util.concurrent.Semaphore;\nimport java.util.concurrent.TimeUnit;\n\npublic class "
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/AsyncServer.java",
"chars": 34561,
"preview": "package com.jeffmony.async;\n\nimport android.os.Build;\nimport android.os.Handler;\nimport android.os.SystemClock;\nimport a"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/AsyncServerSocket.java",
"chars": 109,
"preview": "package com.jeffmony.async;\n\npublic interface AsyncServerSocket {\n void stop();\n int getLocalPort();\n}\n"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/AsyncSocket.java",
"chars": 121,
"preview": "package com.jeffmony.async;\n\npublic interface AsyncSocket extends DataEmitter, DataSink {\n AsyncServer getServer();\n}"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/BufferedDataSink.java",
"chars": 3744,
"preview": "package com.jeffmony.async;\n\nimport com.jeffmony.async.callback.CompletedCallback;\nimport com.jeffmony.async.callback.Wr"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/ByteBufferList.java",
"chars": 15718,
"preview": "package com.jeffmony.async;\n\nimport android.annotation.TargetApi;\nimport android.os.Build;\nimport android.os.Looper;\n\nim"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/ChannelWrapper.java",
"chars": 1621,
"preview": "package com.jeffmony.async;\n\nimport java.io.IOException;\nimport java.net.InetAddress;\nimport java.nio.ByteBuffer;\nimport"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/DataEmitter.java",
"chars": 499,
"preview": "package com.jeffmony.async;\n\nimport com.jeffmony.async.callback.CompletedCallback;\nimport com.jeffmony.async.callback.Da"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/DataEmitterBase.java",
"chars": 1026,
"preview": "package com.jeffmony.async;\n\nimport com.jeffmony.async.callback.CompletedCallback;\nimport com.jeffmony.async.callback.Da"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/DataEmitterReader.java",
"chars": 1380,
"preview": "package com.jeffmony.async;\n\nimport com.jeffmony.async.callback.DataCallback;\n\npublic class DataEmitterReader implements"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/DataSink.java",
"chars": 530,
"preview": "package com.jeffmony.async;\n\nimport com.jeffmony.async.callback.CompletedCallback;\nimport com.jeffmony.async.callback.Wr"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/DataTrackingEmitter.java",
"chars": 355,
"preview": "package com.jeffmony.async;\n\n/**\n * Created by koush on 5/28/13.\n */\npublic interface DataTrackingEmitter extends DataEm"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/DatagramChannelWrapper.java",
"chars": 2553,
"preview": "package com.jeffmony.async;\n\nimport java.io.IOException;\nimport java.net.InetAddress;\nimport java.net.InetSocketAddress;"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/FileDataEmitter.java",
"chars": 2636,
"preview": "package com.jeffmony.async;\n\nimport com.jeffmony.async.callback.DataCallback;\nimport com.jeffmony.async.util.StreamUtili"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/FilteredDataEmitter.java",
"chars": 2603,
"preview": "package com.jeffmony.async;\n\nimport com.jeffmony.async.callback.CompletedCallback;\nimport com.jeffmony.async.callback.Da"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/FilteredDataSink.java",
"chars": 560,
"preview": "package com.jeffmony.async;\n\npublic class FilteredDataSink extends BufferedDataSink {\n public FilteredDataSink(DataSi"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/HostnameResolutionException.java",
"chars": 179,
"preview": "package com.jeffmony.async;\n\npublic class HostnameResolutionException extends Exception {\n public HostnameResolutionE"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/LineEmitter.java",
"chars": 1352,
"preview": "package com.jeffmony.async;\n\nimport com.jeffmony.async.callback.DataCallback;\n\nimport java.nio.ByteBuffer;\nimport java.n"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/PushParser.java",
"chars": 11270,
"preview": "package com.jeffmony.async;\n\nimport android.util.Log;\n\nimport com.jeffmony.async.callback.DataCallback;\n\nimport java.lan"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/SelectorWrapper.java",
"chars": 2694,
"preview": "package com.jeffmony.async;\n\nimport java.io.Closeable;\nimport java.io.IOException;\nimport java.nio.channels.SelectionKey"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/ServerSocketChannelWrapper.java",
"chars": 2227,
"preview": "package com.jeffmony.async;\n\nimport java.io.IOException;\nimport java.net.InetAddress;\nimport java.nio.ByteBuffer;\nimport"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/SocketChannelWrapper.java",
"chars": 2014,
"preview": "package com.jeffmony.async;\n\nimport java.io.IOException;\nimport java.net.InetAddress;\nimport java.nio.ByteBuffer;\nimport"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/TapCallback.java",
"chars": 63,
"preview": "package com.jeffmony.async;\n\n\npublic interface TapCallback {\n}\n"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/ThreadQueue.java",
"chars": 1500,
"preview": "package com.jeffmony.async;\n\nimport java.util.LinkedList;\nimport java.util.WeakHashMap;\nimport java.util.concurrent.Sema"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/Util.java",
"chars": 9692,
"preview": "package com.jeffmony.async;\n\nimport com.jeffmony.async.callback.CompletedCallback;\nimport com.jeffmony.async.callback.Da"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/ZipDataSink.java",
"chars": 1774,
"preview": "package com.jeffmony.async;\n\nimport com.jeffmony.async.callback.CompletedCallback;\n\nimport java.io.ByteArrayOutputStream"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/callback/CompletedCallback.java",
"chars": 267,
"preview": "package com.jeffmony.async.callback;\n\npublic interface CompletedCallback {\n class NullCompletedCallback implements Co"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/callback/ConnectCallback.java",
"chars": 178,
"preview": "package com.jeffmony.async.callback;\n\nimport com.jeffmony.async.AsyncSocket;\n\npublic interface ConnectCallback {\n voi"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/callback/ContinuationCallback.java",
"chars": 217,
"preview": "package com.jeffmony.async.callback;\n\nimport com.jeffmony.async.future.Continuation;\n\npublic interface ContinuationCallb"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/callback/DataCallback.java",
"chars": 412,
"preview": "package com.jeffmony.async.callback;\n\nimport com.jeffmony.async.ByteBufferList;\nimport com.jeffmony.async.DataEmitter;\n\n"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/callback/ListenCallback.java",
"chars": 274,
"preview": "package com.jeffmony.async.callback;\n\nimport com.jeffmony.async.AsyncServerSocket;\nimport com.jeffmony.async.AsyncSocket"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/callback/ResultCallback.java",
"chars": 142,
"preview": "package com.jeffmony.async.callback;\n\npublic interface ResultCallback<S, T> {\n public void onCompleted(Exception e, S"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/callback/SocketCreateCallback.java",
"chars": 121,
"preview": "package com.jeffmony.async.callback;\n\npublic interface SocketCreateCallback {\n void onSocketCreated(int localPort);\n}"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/callback/ValueCallback.java",
"chars": 143,
"preview": "package com.jeffmony.async.callback;\n\n/**\n * Created by koush on 7/5/16.\n */\npublic interface ValueCallback<T> {\n voi"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/callback/ValueFunction.java",
"chars": 111,
"preview": "package com.jeffmony.async.callback;\n\npublic interface ValueFunction<T> {\n T getValue() throws Exception;\n}\n"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/callback/WritableCallback.java",
"chars": 107,
"preview": "package com.jeffmony.async.callback;\n\npublic interface WritableCallback {\n public void onWriteable();\n}\n"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/dns/Dns.java",
"chars": 5891,
"preview": "package com.jeffmony.async.dns;\n\nimport com.jeffmony.async.AsyncDatagramSocket;\nimport com.jeffmony.async.AsyncServer;\ni"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/dns/DnsResponse.java",
"chars": 5354,
"preview": "package com.jeffmony.async.dns;\n\nimport com.jeffmony.async.ByteBufferList;\nimport com.jeffmony.async.http.Multimap;\n\nimp"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/Cancellable.java",
"chars": 497,
"preview": "package com.jeffmony.async.future;\n\npublic interface Cancellable {\n /**\n * Check whether this asynchronous operat"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/Continuation.java",
"chars": 4640,
"preview": "package com.jeffmony.async.future;\n\nimport com.jeffmony.async.callback.CompletedCallback;\nimport com.jeffmony.async.call"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/Converter.java",
"chars": 15003,
"preview": "package com.jeffmony.async.future;\n\nimport android.text.TextUtils;\n\nimport com.jeffmony.async.ByteBufferList;\n\nimport or"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/DependentCancellable.java",
"chars": 141,
"preview": "package com.jeffmony.async.future;\n\npublic interface DependentCancellable extends Cancellable {\n boolean setParent(Ca"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/DependentFuture.java",
"chars": 116,
"preview": "package com.jeffmony.async.future;\n\npublic interface DependentFuture<T> extends Future<T>, DependentCancellable {\n}\n"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/DoneCallback.java",
"chars": 128,
"preview": "package com.jeffmony.async.future;\n\npublic interface DoneCallback<T> {\n void done(Exception e, T result) throws Excep"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/FailCallback.java",
"chars": 297,
"preview": "package com.jeffmony.async.future;\n\npublic interface FailCallback {\n /**\n * Callback that is invoked when a futur"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/FailConvertCallback.java",
"chars": 337,
"preview": "package com.jeffmony.async.future;\n\npublic interface FailConvertCallback<T> {\n /**\n * Callback that is invoked wh"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/FailRecoverCallback.java",
"chars": 352,
"preview": "package com.jeffmony.async.future;\n\npublic interface FailRecoverCallback<T> {\n /**\n * Callback that is invoked wh"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/Future.java",
"chars": 3162,
"preview": "package com.jeffmony.async.future;\n\nimport android.os.Build;\n\nimport androidx.annotation.RequiresApi;\n\nimport java.util."
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/FutureCallback.java",
"chars": 390,
"preview": "package com.jeffmony.async.future;\n\n/**\n * Created by koush on 5/20/13.\n */\npublic interface FutureCallback<T> {\n /**"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/FutureRunnable.java",
"chars": 146,
"preview": "package com.jeffmony.async.future;\n\n/**\n * Created by koush on 12/22/13.\n */\npublic interface FutureRunnable<T> {\n T "
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/FutureThread.java",
"chars": 1070,
"preview": "package com.jeffmony.async.future;\n\nimport java.util.concurrent.ExecutorService;\n\n/**\n * Created by koush on 12/22/13.\n "
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/Futures.java",
"chars": 2155,
"preview": "package com.jeffmony.async.future;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Iterator;\nimpo"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/HandlerFuture.java",
"chars": 1074,
"preview": "package com.jeffmony.async.future;\n\nimport android.os.Handler;\nimport android.os.Looper;\n\n/**\n * Created by koush on 12/"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/MultiFuture.java",
"chars": 1931,
"preview": "package com.jeffmony.async.future;\n\nimport java.util.ArrayList;\n\n/**\n * Created by koush on 2/25/14.\n */\npublic class Mu"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/MultiTransformFuture.java",
"chars": 595,
"preview": "package com.jeffmony.async.future;\n\npublic abstract class MultiTransformFuture<T, F> extends MultiFuture<T> implements F"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/SimpleCancellable.java",
"chars": 2077,
"preview": "package com.jeffmony.async.future;\n\npublic class SimpleCancellable implements DependentCancellable {\n boolean complet"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/SimpleFuture.java",
"chars": 12049,
"preview": "package com.jeffmony.async.future;\n\nimport com.jeffmony.async.AsyncSemaphore;\n\nimport java.util.concurrent.CancellationE"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/SuccessCallback.java",
"chars": 120,
"preview": "package com.jeffmony.async.future;\n\npublic interface SuccessCallback<T> {\n void success(T value) throws Exception;\n}\n"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/ThenCallback.java",
"chars": 290,
"preview": "package com.jeffmony.async.future;\n\npublic interface ThenCallback<T, F> {\n /**\n * Callback that is invoked when F"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/ThenFutureCallback.java",
"chars": 308,
"preview": "package com.jeffmony.async.future;\n\npublic interface ThenFutureCallback<T, F> {\n /**\n * Callback that is invoked "
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/TransformFuture.java",
"chars": 706,
"preview": "package com.jeffmony.async.future;\n\npublic abstract class TransformFuture<T, F> extends SimpleFuture<T> implements Futur"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/future/TypeConverter.java",
"chars": 142,
"preview": "package com.jeffmony.async.future;\n\npublic interface TypeConverter<T, F> {\n Future<T> convert(F from, String fromMime"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpClient.java",
"chars": 28400,
"preview": "package com.jeffmony.async.http;\n\nimport android.annotation.SuppressLint;\nimport android.net.Uri;\nimport android.os.Buil"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpClientMiddleware.java",
"chars": 3538,
"preview": "package com.jeffmony.async.http;\n\nimport com.jeffmony.async.AsyncSocket;\nimport com.jeffmony.async.DataEmitter;\nimport c"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpDelete.java",
"chars": 318,
"preview": "package com.jeffmony.async.http;\n\nimport android.net.Uri;\n\npublic class AsyncHttpDelete extends AsyncHttpRequest {\n p"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpGet.java",
"chars": 319,
"preview": "package com.jeffmony.async.http;\n\nimport android.net.Uri;\n\npublic class AsyncHttpGet extends AsyncHttpRequest {\n publ"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpHead.java",
"chars": 348,
"preview": "package com.jeffmony.async.http;\n\nimport android.net.Uri;\n\n/**\n * Created by koush on 8/25/13.\n */\npublic class AsyncHtt"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpPost.java",
"chars": 314,
"preview": "package com.jeffmony.async.http;\n\nimport android.net.Uri;\n\npublic class AsyncHttpPost extends AsyncHttpRequest {\n pub"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpPut.java",
"chars": 310,
"preview": "package com.jeffmony.async.http;\n\nimport android.net.Uri;\n\npublic class AsyncHttpPut extends AsyncHttpRequest {\n publ"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpRequest.java",
"chars": 7326,
"preview": "package com.jeffmony.async.http;\n\nimport android.net.Uri;\nimport android.util.Log;\n\nimport com.jeffmony.async.AsyncSSLEx"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpResponse.java",
"chars": 323,
"preview": "package com.jeffmony.async.http;\n\nimport com.jeffmony.async.AsyncSocket;\nimport com.jeffmony.async.DataEmitter;\n\npublic "
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/AsyncHttpResponseImpl.java",
"chars": 5388,
"preview": "package com.jeffmony.async.http;\n\nimport com.jeffmony.async.AsyncServer;\nimport com.jeffmony.async.AsyncSocket;\nimport c"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/AsyncSSLEngineConfigurator.java",
"chars": 343,
"preview": "package com.jeffmony.async.http;\n\nimport javax.net.ssl.SSLContext;\nimport javax.net.ssl.SSLEngine;\n\npublic interface Asy"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/AsyncSSLSocketMiddleware.java",
"chars": 6599,
"preview": "package com.jeffmony.async.http;\n\nimport android.net.Uri;\nimport android.text.TextUtils;\n\nimport com.jeffmony.async.Asyn"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/AsyncSocketMiddleware.java",
"chars": 13136,
"preview": "package com.jeffmony.async.http;\n\nimport android.net.Uri;\n\nimport com.jeffmony.async.AsyncSocket;\nimport com.jeffmony.as"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/BasicNameValuePair.java",
"chars": 5804,
"preview": "/*\n * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/BodyDecoderException.java",
"chars": 170,
"preview": "package com.jeffmony.async.http;\n\npublic class BodyDecoderException extends Exception {\n public BodyDecoderException("
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/ConnectionClosedException.java",
"chars": 310,
"preview": "package com.jeffmony.async.http;\n\npublic class ConnectionClosedException extends Exception {\n public ConnectionClosed"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/ConnectionFailedException.java",
"chars": 180,
"preview": "package com.jeffmony.async.http;\n\npublic class ConnectionFailedException extends Exception {\n public ConnectionFailed"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/Headers.java",
"chars": 4163,
"preview": "package com.jeffmony.async.http;\n\nimport android.text.TextUtils;\n\nimport java.util.Collection;\nimport java.util.List;\nim"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/HttpDate.java",
"chars": 3232,
"preview": "/*\n * Copyright (C) 2011 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lice"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/HttpTransportMiddleware.java",
"chars": 5957,
"preview": "package com.jeffmony.async.http;\n\nimport android.text.TextUtils;\n\nimport com.jeffmony.async.AsyncSocket;\nimport com.jeff"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/HttpUtil.java",
"chars": 5870,
"preview": "package com.jeffmony.async.http;\n\nimport com.jeffmony.async.AsyncServer;\nimport com.jeffmony.async.DataEmitter;\nimport c"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/HybiParser.java",
"chars": 16658,
"preview": "//\n// HybiParser.java: draft-ietf-hybi-thewebsocketprotocol-13 parser\n//\n// Based on code from the faye project.\n// http"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/Multimap.java",
"chars": 4501,
"preview": "package com.jeffmony.async.http;\n\nimport android.net.Uri;\nimport android.text.TextUtils;\n\nimport java.net.URLDecoder;\nim"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/NameValuePair.java",
"chars": 4178,
"preview": "/*\n * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/Protocol.java",
"chars": 3355,
"preview": "package com.jeffmony.async.http;\n\nimport java.util.Hashtable;\nimport java.util.Locale;\n\n/**\n * Protocols that OkHttp imp"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/ProtocolVersion.java",
"chars": 9844,
"preview": "/*\n * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/RedirectLimitExceededException.java",
"chars": 190,
"preview": "package com.jeffmony.async.http;\n\npublic class RedirectLimitExceededException extends Exception {\n public RedirectLim"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/RequestLine.java",
"chars": 1815,
"preview": "/*\n * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/SSLEngineSNIConfigurator.java",
"chars": 3143,
"preview": "package com.jeffmony.async.http;\n\nimport android.os.Build;\n\nimport java.lang.reflect.Field;\nimport java.util.Hashtable;\n"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/SimpleMiddleware.java",
"chars": 864,
"preview": "package com.jeffmony.async.http;\n\nimport com.jeffmony.async.future.Cancellable;\n\npublic class SimpleMiddleware implement"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/TaggedList.java",
"chars": 398,
"preview": "package com.jeffmony.async.http;\n\nimport java.util.ArrayList;\n\npublic class TaggedList<T> extends ArrayList<T> {\n pri"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/WebSocket.java",
"chars": 850,
"preview": "package com.jeffmony.async.http;\n\nimport com.jeffmony.async.AsyncSocket;\n\npublic interface WebSocket extends AsyncSocket"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/WebSocketHandshakeException.java",
"chars": 184,
"preview": "package com.jeffmony.async.http;\n\npublic class WebSocketHandshakeException extends Exception {\n public WebSocketHands"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/WebSocketImpl.java",
"chars": 11195,
"preview": "package com.jeffmony.async.http;\n\nimport android.text.TextUtils;\nimport android.util.Base64;\n\nimport com.jeffmony.async."
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/body/AsyncHttpRequestBody.java",
"chars": 509,
"preview": "package com.jeffmony.async.http.body;\n\nimport com.jeffmony.async.DataEmitter;\nimport com.jeffmony.async.DataSink;\nimport"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/body/ByteBufferListRequestBody.java",
"chars": 1388,
"preview": "package com.jeffmony.async.http.body;\n\nimport com.jeffmony.async.ByteBufferList;\nimport com.jeffmony.async.DataEmitter;\n"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/body/DocumentBody.java",
"chars": 2595,
"preview": "package com.jeffmony.async.http.body;\n\nimport com.jeffmony.async.DataEmitter;\nimport com.jeffmony.async.DataSink;\nimport"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/body/FileBody.java",
"chars": 1447,
"preview": "package com.jeffmony.async.http.body;\n\nimport com.jeffmony.async.DataEmitter;\nimport com.jeffmony.async.DataSink;\nimport"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/body/FilePart.java",
"chars": 878,
"preview": "package com.jeffmony.async.http.body;\n\nimport com.jeffmony.async.http.BasicNameValuePair;\nimport com.jeffmony.async.http"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/body/JSONArrayBody.java",
"chars": 1622,
"preview": "package com.jeffmony.async.http.body;\n\nimport com.jeffmony.async.DataEmitter;\nimport com.jeffmony.async.DataSink;\nimport"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/body/JSONObjectBody.java",
"chars": 1632,
"preview": "package com.jeffmony.async.http.body;\n\nimport com.jeffmony.async.DataEmitter;\nimport com.jeffmony.async.DataSink;\nimport"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/body/MultipartFormDataBody.java",
"chars": 8277,
"preview": "package com.jeffmony.async.http.body;\n\nimport android.text.TextUtils;\n\nimport com.jeffmony.async.ByteBufferList;\nimport "
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/body/Part.java",
"chars": 2175,
"preview": "package com.jeffmony.async.http.body;\n\nimport com.jeffmony.async.DataSink;\nimport com.jeffmony.async.callback.CompletedC"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/body/StreamBody.java",
"chars": 1599,
"preview": "package com.jeffmony.async.http.body;\n\nimport com.jeffmony.async.DataEmitter;\nimport com.jeffmony.async.DataSink;\nimport"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/body/StreamPart.java",
"chars": 843,
"preview": "package com.jeffmony.async.http.body;\n\nimport com.jeffmony.async.DataSink;\nimport com.jeffmony.async.Util;\nimport com.je"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/body/StringBody.java",
"chars": 1742,
"preview": "package com.jeffmony.async.http.body;\n\nimport com.jeffmony.async.DataEmitter;\nimport com.jeffmony.async.DataSink;\nimport"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/body/StringPart.java",
"chars": 613,
"preview": "package com.jeffmony.async.http.body;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.I"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/body/UrlEncodedFormBody.java",
"chars": 3256,
"preview": "package com.jeffmony.async.http.body;\n\nimport com.jeffmony.async.ByteBufferList;\nimport com.jeffmony.async.DataEmitter;\n"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/cache/HeaderParser.java",
"chars": 3696,
"preview": "/*\n * Copyright (C) 2011 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lice"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/cache/Objects.java",
"chars": 997,
"preview": "/*\n * Copyright (C) 2010 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lice"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/cache/RawHeaders.java",
"chars": 10709,
"preview": "package com.jeffmony.async.http.cache;\n\n/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * co"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/cache/RequestHeaders.java",
"chars": 9401,
"preview": "/*\n * Copyright (C) 2011 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lice"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/cache/ResponseCacheMiddleware.java",
"chars": 30045,
"preview": "package com.jeffmony.async.http.cache;\n\nimport android.net.Uri;\nimport android.util.Base64;\n\nimport com.jeffmony.async.A"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/cache/ResponseHeaders.java",
"chars": 18457,
"preview": "/*\n * Copyright (C) 2011 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lice"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/cache/ResponseSource.java",
"chars": 1134,
"preview": "/*\n * Copyright (C) 2011 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lice"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/cache/StrictLineReader.java",
"chars": 9430,
"preview": "/*\n * Copyright (C) 2012 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lice"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/callback/HttpConnectCallback.java",
"chars": 206,
"preview": "package com.jeffmony.async.http.callback;\n\nimport com.jeffmony.async.http.AsyncHttpResponse;\n\npublic interface HttpConne"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/callback/RequestCallback.java",
"chars": 356,
"preview": "package com.jeffmony.async.http.callback;\n\nimport com.jeffmony.async.callback.ResultCallback;\nimport com.jeffmony.async."
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/filter/ChunkedDataException.java",
"chars": 177,
"preview": "package com.jeffmony.async.http.filter;\n\npublic class ChunkedDataException extends Exception {\n public ChunkedDataExc"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/filter/ChunkedInputFilter.java",
"chars": 4146,
"preview": "package com.jeffmony.async.http.filter;\n\nimport com.jeffmony.async.ByteBufferList;\nimport com.jeffmony.async.DataEmitter"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/filter/ChunkedOutputFilter.java",
"chars": 931,
"preview": "package com.jeffmony.async.http.filter;\n\n\nimport com.jeffmony.async.ByteBufferList;\nimport com.jeffmony.async.DataSink;\n"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/filter/ContentLengthFilter.java",
"chars": 1295,
"preview": "package com.jeffmony.async.http.filter;\n\nimport com.jeffmony.async.ByteBufferList;\nimport com.jeffmony.async.DataEmitter"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/filter/DataRemainingException.java",
"chars": 205,
"preview": "package com.jeffmony.async.http.filter;\n\npublic class DataRemainingException extends Exception {\n public DataRemainin"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/filter/GZIPInputFilter.java",
"chars": 5560,
"preview": "package com.jeffmony.async.http.filter;\n\nimport com.jeffmony.async.ByteBufferList;\nimport com.jeffmony.async.DataEmitter"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/filter/InflaterInputFilter.java",
"chars": 2275,
"preview": "package com.jeffmony.async.http.filter;\n\nimport com.jeffmony.async.ByteBufferList;\nimport com.jeffmony.async.DataEmitter"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/filter/PrematureDataEndException.java",
"chars": 187,
"preview": "package com.jeffmony.async.http.filter;\n\npublic class PrematureDataEndException extends Exception {\n public Premature"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/server/AsyncHttpRequestBodyProvider.java",
"chars": 241,
"preview": "package com.jeffmony.async.http.server;\n\nimport com.jeffmony.async.http.Headers;\nimport com.jeffmony.async.http.body.Asy"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/server/AsyncHttpServer.java",
"chars": 12718,
"preview": "package com.jeffmony.async.http.server;\n\nimport android.annotation.TargetApi;\nimport android.os.Build;\nimport android.ut"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/server/AsyncHttpServerRequest.java",
"chars": 705,
"preview": "package com.jeffmony.async.http.server;\n\nimport com.jeffmony.async.AsyncSocket;\nimport com.jeffmony.async.DataEmitter;\ni"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/server/AsyncHttpServerRequestImpl.java",
"chars": 4803,
"preview": "package com.jeffmony.async.http.server;\n\nimport com.jeffmony.async.AsyncSocket;\nimport com.jeffmony.async.DataEmitter;\ni"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/server/AsyncHttpServerResponse.java",
"chars": 1566,
"preview": "package com.jeffmony.async.http.server;\n\nimport com.jeffmony.async.AsyncSocket;\nimport com.jeffmony.async.ByteBufferList"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/server/AsyncHttpServerResponseImpl.java",
"chars": 13183,
"preview": "package com.jeffmony.async.http.server;\n\nimport android.text.TextUtils;\n\nimport com.jeffmony.async.AsyncServer;\nimport c"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/server/AsyncHttpServerRouter.java",
"chars": 15162,
"preview": "package com.jeffmony.async.http.server;\n\nimport android.content.Context;\nimport android.content.res.AssetManager;\nimport"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/server/AsyncProxyServer.java",
"chars": 2364,
"preview": "package com.jeffmony.async.http.server;\n\nimport android.net.Uri;\n\nimport com.jeffmony.async.AsyncServer;\nimport com.jeff"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/server/BoundaryEmitter.java",
"chars": 6262,
"preview": "package com.jeffmony.async.http.server;\n\nimport com.jeffmony.async.ByteBufferList;\nimport com.jeffmony.async.DataEmitter"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/server/HttpServerRequestCallback.java",
"chars": 175,
"preview": "package com.jeffmony.async.http.server;\n\n\npublic interface HttpServerRequestCallback {\n void onRequest(AsyncHttpServe"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/server/MalformedRangeException.java",
"chars": 100,
"preview": "package com.jeffmony.async.http.server;\n\npublic class MalformedRangeException extends Exception {\n}\n"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/server/MimeEncodingException.java",
"chars": 179,
"preview": "package com.jeffmony.async.http.server;\n\npublic class MimeEncodingException extends Exception {\n public MimeEncodingE"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/server/RouteMatcher.java",
"chars": 146,
"preview": "package com.jeffmony.async.http.server;\n\npublic interface RouteMatcher {\n AsyncHttpServerRouter.RouteMatch route(Stri"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/server/StreamSkipException.java",
"chars": 175,
"preview": "package com.jeffmony.async.http.server;\n\npublic class StreamSkipException extends Exception {\n public StreamSkipExcep"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/http/server/UnknownRequestBody.java",
"chars": 1843,
"preview": "package com.jeffmony.async.http.server;\n\nimport com.jeffmony.async.DataEmitter;\nimport com.jeffmony.async.DataSink;\nimpo"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/parser/AsyncParser.java",
"chars": 468,
"preview": "package com.jeffmony.async.parser;\n\nimport com.jeffmony.async.DataEmitter;\nimport com.jeffmony.async.DataSink;\nimport co"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/parser/ByteBufferListParser.java",
"chars": 1891,
"preview": "package com.jeffmony.async.parser;\n\nimport com.jeffmony.async.ByteBufferList;\nimport com.jeffmony.async.DataEmitter;\nimp"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/parser/DocumentParser.java",
"chars": 1124,
"preview": "package com.jeffmony.async.parser;\n\nimport com.jeffmony.async.DataEmitter;\nimport com.jeffmony.async.DataSink;\nimport co"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/parser/JSONArrayParser.java",
"chars": 881,
"preview": "package com.jeffmony.async.parser;\n\nimport com.jeffmony.async.DataEmitter;\nimport com.jeffmony.async.DataSink;\nimport co"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/parser/JSONObjectParser.java",
"chars": 879,
"preview": "package com.jeffmony.async.parser;\n\nimport com.jeffmony.async.DataEmitter;\nimport com.jeffmony.async.DataSink;\nimport co"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/parser/StringParser.java",
"chars": 1355,
"preview": "package com.jeffmony.async.parser;\n\nimport com.jeffmony.async.ByteBufferList;\nimport com.jeffmony.async.DataEmitter;\nimp"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/stream/ByteBufferListInputStream.java",
"chars": 914,
"preview": "package com.jeffmony.async.stream;\n\nimport com.jeffmony.async.ByteBufferList;\n\nimport java.io.IOException;\nimport java.i"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/stream/FileDataSink.java",
"chars": 729,
"preview": "package com.jeffmony.async.stream;\n\nimport com.jeffmony.async.AsyncServer;\n\nimport java.io.File;\nimport java.io.FileOutp"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/stream/InputStreamDataEmitter.java",
"chars": 3831,
"preview": "package com.jeffmony.async.stream;\n\nimport com.jeffmony.async.AsyncServer;\nimport com.jeffmony.async.ByteBufferList;\nimp"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/stream/OutputStreamDataCallback.java",
"chars": 1321,
"preview": "package com.jeffmony.async.stream;\n\nimport com.jeffmony.async.ByteBufferList;\nimport com.jeffmony.async.DataEmitter;\nimp"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/stream/OutputStreamDataSink.java",
"chars": 2761,
"preview": "package com.jeffmony.async.stream;\n\nimport com.jeffmony.async.AsyncServer;\nimport com.jeffmony.async.ByteBufferList;\nimp"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/util/Allocator.java",
"chars": 1074,
"preview": "package com.jeffmony.async.util;\n\nimport com.jeffmony.async.ByteBufferList;\n\nimport java.nio.ByteBuffer;\n\n/**\n * Created"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/util/ArrayDeque.java",
"chars": 29103,
"preview": "/*\n * Written by Josh Bloch of Google Inc. and released to the public domain,\n * as explained at http://creativecommons."
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/util/Charsets.java",
"chars": 340,
"preview": "package com.jeffmony.async.util;\n\nimport java.nio.charset.Charset;\n\n/** From java.nio.charset.Charsets */\npublic class C"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/util/Deque.java",
"chars": 22276,
"preview": "/*\n * Written by Doug Lea and Josh Bloch with assistance from members of\n * JCP JSR-166 Expert Group and released to the"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/util/FileCache.java",
"chars": 8540,
"preview": "package com.jeffmony.async.util;\n\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimpor"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/util/FileUtility.java",
"chars": 638,
"preview": "package com.jeffmony.async.util;\n\nimport java.io.File;\n\n/**\n * Created by koush on 4/7/14.\n */\npublic class FileUtility "
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/util/HashList.java",
"chars": 2009,
"preview": "package com.jeffmony.async.util;\n\nimport java.util.ArrayList;\nimport java.util.Hashtable;\nimport java.util.Set;\n\n/**\n * "
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/util/IdleTimeout.java",
"chars": 924,
"preview": "package com.jeffmony.async.util;\n\nimport android.os.Handler;\n\nimport com.jeffmony.async.AsyncServer;\n\npublic class IdleT"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/util/LruCache.java",
"chars": 10533,
"preview": "/*\n * Copyright (C) 2011 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"Lice"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/util/StreamUtility.java",
"chars": 4010,
"preview": "package com.jeffmony.async.util;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.Closeable;\nimport java.io.DataInp"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/util/TaggedList.java",
"chars": 398,
"preview": "package com.jeffmony.async.util;\n\nimport java.util.ArrayList;\n\npublic class TaggedList<T> extends ArrayList<T> {\n pri"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/util/ThrottleTimeout.java",
"chars": 2342,
"preview": "package com.jeffmony.async.util;\n\nimport android.os.Handler;\n\nimport com.jeffmony.async.AsyncServer;\nimport com.jeffmony"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/util/TimeoutBase.java",
"chars": 1841,
"preview": "package com.jeffmony.async.util;\n\nimport android.os.Handler;\n\nimport com.jeffmony.async.AsyncServer;\nimport com.jeffmony"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/util/UntypedHashtable.java",
"chars": 566,
"preview": "package com.jeffmony.async.util;\n\nimport java.util.Hashtable;\n\npublic class UntypedHashtable {\n private Hashtable<Str"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/wrapper/AsyncSocketWrapper.java",
"chars": 186,
"preview": "package com.jeffmony.async.wrapper;\n\nimport com.jeffmony.async.AsyncSocket;\n\npublic interface AsyncSocketWrapper extends"
},
{
"path": "androidasync/src/main/java/com/jeffmony/async/wrapper/DataEmitterWrapper.java",
"chars": 171,
"preview": "package com.jeffmony.async.wrapper;\n\nimport com.jeffmony.async.DataEmitter;\n\npublic interface DataEmitterWrapper extends"
},
{
"path": "app/build.gradle",
"chars": 988,
"preview": "apply plugin: 'com.android.application'\n\nandroid {\n compileSdkVersion 29\n buildToolsVersion \"29.0.2\"\n\n defaultC"
},
{
"path": "app/proguard-rules.pro",
"chars": 751,
"preview": "# Add project specific ProGuard rules here.\n# You can control the set of applied configuration files using the\n# proguar"
},
{
"path": "app/src/main/AndroidManifest.xml",
"chars": 1776,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package="
},
{
"path": "app/src/main/assets/list.json",
"chars": 952,
"preview": "[\n {\n \"name\": \"Test url 1\",\n \"uri\": \"https://tv.youkutv.cc/2019/10/28/6MSVuLec4zbpYFlj/playlist.m3u8\"\n },\n {\n "
},
{
"path": "app/src/main/java/com/android/media/DownloadBaseListActivity.java",
"chars": 7116,
"preview": "package com.android.media;\n\nimport android.os.Bundle;\nimport android.view.View;\nimport android.widget.AdapterView;\nimpor"
},
{
"path": "app/src/main/java/com/android/media/DownloadFeatureActivity.java",
"chars": 1906,
"preview": "package com.android.media;\n\nimport android.content.Intent;\nimport android.os.Bundle;\nimport android.view.View;\nimport an"
},
{
"path": "app/src/main/java/com/android/media/DownloadOrcodeActivity.java",
"chars": 1174,
"preview": "package com.android.media;\n\nimport android.os.Bundle;\nimport android.view.View;\nimport android.widget.Button;\nimport and"
},
{
"path": "app/src/main/java/com/android/media/DownloadPlayActivity.java",
"chars": 8939,
"preview": "package com.android.media;\n\nimport android.graphics.SurfaceTexture;\nimport android.net.Uri;\nimport android.os.Bundle;\nim"
},
{
"path": "app/src/main/java/com/android/media/DownloadSettingsActivity.java",
"chars": 5955,
"preview": "package com.android.media;\n\nimport android.content.Intent;\nimport android.net.Uri;\nimport android.os.Bundle;\nimport andr"
},
{
"path": "app/src/main/java/com/android/media/MainActivity.java",
"chars": 1401,
"preview": "package com.android.media;\n\nimport android.content.Intent;\nimport android.os.Bundle;\nimport android.view.View;\nimport an"
},
{
"path": "app/src/main/java/com/android/media/MediaScannerActivity.java",
"chars": 389,
"preview": "package com.android.media;\n\nimport android.os.Bundle;\n\nimport androidx.annotation.Nullable;\nimport androidx.appcompat.ap"
},
{
"path": "app/src/main/java/com/android/media/MyApplication.java",
"chars": 1102,
"preview": "package com.android.media;\n\nimport android.app.Application;\n\nimport com.media.cache.DownloadConstants;\nimport com.media."
},
{
"path": "app/src/main/java/com/android/media/PlayFeatureActivity.java",
"chars": 7488,
"preview": "package com.android.media;\n\nimport android.content.Intent;\nimport android.content.pm.PackageManager;\nimport android.os.B"
},
{
"path": "app/src/main/java/com/android/media/PlayerActivity.java",
"chars": 11048,
"preview": "package com.android.media;\n\nimport android.graphics.SurfaceTexture;\nimport android.net.Uri;\nimport android.os.Bundle;\nim"
}
]
// ... and 746 more files (download for full content)
About this extraction
This page contains the full source code of the JeffMony/MediaSDK GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 946 files (6.6 MB), approximately 1.8M tokens, and a symbol index with 11816 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.