package net.pterodactylus.sonitus.data.source;
import static com.google.common.base.Preconditions.checkNotNull;
package net.pterodactylus.sonitus.data.source;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.EOFException;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.io.EOFException;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
* if the file can not be found, or an I/O error occurs
*/
public FileSource(String path) throws IOException {
* if the file can not be found, or an I/O error occurs
*/
public FileSource(String path) throws IOException {
this.path = checkNotNull(path, "path must not be null");
fileInputStream = new FileInputStream(path);
/* identify file type. */
Optional<IdentifyingInputStream> identifyingInputStream = IdentifyingInputStream.create(new FileInputStream(path));
if (identifyingInputStream.isPresent()) {
this.path = checkNotNull(path, "path must not be null");
fileInputStream = new FileInputStream(path);
/* identify file type. */
Optional<IdentifyingInputStream> identifyingInputStream = IdentifyingInputStream.create(new FileInputStream(path));
if (identifyingInputStream.isPresent()) {
public byte[] get(int bufferSize) throws IOException {
byte[] buffer = new byte[bufferSize];
int read = fileInputStream.read(buffer);
public byte[] get(int bufferSize) throws IOException {
byte[] buffer = new byte[bufferSize];
int read = fileInputStream.read(buffer);