Skip to content

Commit

Permalink
Merge pull request #68 from HelgeStenstrom/makeFieldsFinal
Browse files Browse the repository at this point in the history
Make fields final when they can.
  • Loading branch information
goxr3plus authored Sep 9, 2021
2 parents a94af27 + 7b3caad commit 7caf2f3
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
package com.goxr3plus.streamplayer.application;

import com.goxr3plus.streamplayer.enums.Status;
import com.goxr3plus.streamplayer.stream.StreamPlayer;
import com.goxr3plus.streamplayer.stream.StreamPlayerEvent;
import com.goxr3plus.streamplayer.stream.StreamPlayerInterface;
import com.goxr3plus.streamplayer.stream.StreamPlayerListener;

import java.io.File;
import java.util.Map;

/**
* @author GOXR3PLUS
*
*/
public class AnotherDemoApplication {

private final String audioFileName = "Logic - Ballin [Bass Boosted].mp3";
private static final String AUDIO_FILE_NAME = "Logic - Ballin [Bass Boosted].mp3";

private StreamPlayerInterface streamPlayer;
private StreamPlayerListener listener;
private final StreamPlayerInterface streamPlayer;
private final StreamPlayerListener listener;

public AnotherDemoApplication(StreamPlayerInterface streamPlayer) {
this.streamPlayer = streamPlayer;
this.listener = new AnotherStreamPlayerListener(audioFileName, streamPlayer);
this.listener = new AnotherStreamPlayerListener(AUDIO_FILE_NAME, streamPlayer);

}

Expand All @@ -39,7 +35,7 @@ void start() {
// open(AUDIOURL)

// Example
streamPlayer.open(new File(audioFileName));
streamPlayer.open(new File(AUDIO_FILE_NAME));

//Seek by bytes
//seekBytes(500000L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.goxr3plus.streamplayer.stream.StreamPlayer;
import com.goxr3plus.streamplayer.stream.StreamPlayerInterface;
import com.goxr3plus.streamplayer.stream.StreamPlayerListener;

public class AnotherMain {
public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class AnotherStreamPlayerListener implements StreamPlayerListener {

private final String audioFileName;
private StreamPlayerInterface streamPlayer;
private final StreamPlayerInterface streamPlayer;


public AnotherStreamPlayerListener(String audioFileName, StreamPlayerInterface streamPlayer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
public class DemoApplication extends StreamPlayer implements StreamPlayerListener {

private final String audioFileName = "Logic - Ballin [Bass Boosted].mp3";
private static final String AUDIO_FILE_NAME = "Logic - Ballin [Bass Boosted].mp3";


void start() {
Expand All @@ -29,7 +29,7 @@ void start() {
// open(AUDIOURL)

// Example
open(new File(audioFileName));
open(new File(AUDIO_FILE_NAME));

//Seek by bytes
//seekBytes(500000L);
Expand Down Expand Up @@ -70,7 +70,7 @@ public void progress(final int nEncodedBytes, final long microsecondPosition, fi

// .MP3 OR .WAV
//THE SAMPLE Audio i am using is .MP3 SO ... :)
String extension = getExtension(audioFileName);
String extension = getExtension(AUDIO_FILE_NAME);


long totalBytes = getTotalBytes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

public class FileDataSource implements DataSource {

private File source;
private final File source;

FileDataSource(File source) {
this.source = source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public class StreamDataSource implements DataSource {

private InputStream source;
private final InputStream source;

StreamDataSource(InputStream source) {
this.source = source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class StreamPlayer implements StreamPlayerInterface, Callable<Void> {
/**
* Class logger
*/
private Logger logger;
private final Logger logger;

// -------------------AUDIO----------------,-----

Expand Down Expand Up @@ -145,7 +145,7 @@ public class StreamPlayer implements StreamPlayerInterface, Callable<Void> {
/**
* Responsible for the output SourceDataLine and the controls that depend on it.
*/
private Outlet outlet;
private final Outlet outlet;

/**
* Default parameter less Constructor. A default logger will be used.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

public class UrlDataSource implements DataSource {

private URL source;
private final URL source;

UrlDataSource(URL source) {
this.source = source;
}

@Override
public AudioFileFormat getAudioFileFormat() throws UnsupportedAudioFileException, IOException {
return AudioSystem.getAudioFileFormat((URL) source);
return AudioSystem.getAudioFileFormat(source);
}

@Override
Expand Down

0 comments on commit 7caf2f3

Please sign in to comment.