/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* AU file writer.
*
* @author Jan Borgersen
*/
//$$fb value for length field if length is not known
/**
* Constructs a new AuFileWriter object.
*/
public AuFileWriter() {
}
// make sure we can write this stream
return filetypes;
}
}
public int write(AudioInputStream stream, AudioFileFormat.Type fileType, OutputStream out) throws IOException {
// we must know the total data length to calculate the file length
//$$fb 2001-07-13: fix for bug 4351296: do not throw an exception
//if( stream.getFrameLength() == AudioSystem.NOT_SPECIFIED ) {
// throw new IOException("stream length not specified");
//}
// throws IllegalArgumentException if not supported
return bytesWritten;
}
public int write(AudioInputStream stream, AudioFileFormat.Type fileType, File out) throws IOException {
// throws IllegalArgumentException if not supported
// first write the file without worrying about length fields
// now, if length fields were not specified, calculate them,
// open as a random access file, write the appropriate fields,
// close again....
// $$kk: 10.22.99: jan: please either implement this or throw an exception!
// $$fb: 2001-07-13: done. Fixes Bug 4479981
// skip AU magic and data offset field
// that's all
}
}
return bytesWritten;
}
// -------------------------------------------------------------
/**
* Returns the AudioFileFormat describing the file that will be written from this AudioInputStream.
* Throws IllegalArgumentException if not supported.
*/
float sampleRate;
int sampleSizeInBits;
int channels;
int frameSize;
float frameRate;
int fileSize;
}
} else {
}
true); // AU is always big endian
} else {
}
(int)stream.getFrameLength() );
return fileFormat;
}
private InputStream getFileStream(AuFileFormat auFileFormat, InputStream audioStream) throws IOException {
// private method ... assumes auFileFormat is a supported file type
//$$fb fix for Bug 4351296
//int dataSizeInBytes = dataSize * format.getFrameSize();
long dataSizeInBytes = (dataSize==AudioSystem.NOT_SPECIFIED)?UNKNOWN_SIZE:dataSize * format.getFrameSize();
if (dataSizeInBytes>0x7FFFFFFFl) {
}
//$$fb below is the fix for 4297100.
//boolean bigendian = format.isBigEndian();
boolean bigendian = true; // force bigendian
// if we need to do any format conversion, do it here.
if( audioStream instanceof AudioInputStream ) {
//$$ fb 2001-07-13: Bug 4391108
// plug in the transcoder to convert to PCM_SIGNED, bigendian
// NOTE: little endian AU is not common, so we're always converting
// to big endian unless the passed in audioFileFormat is little.
// $$fb this NOTE is superseded. We always write big endian au files, this is by far the standard.
}
}
baos = new ByteArrayOutputStream();
if (bigendian) {
} else {
}
// Now create a new InputStream from headerStream and the InputStream
// in audioStream
return auStream;
}
private int writeAuFile(InputStream in, AuFileFormat auFileFormat, OutputStream out) throws IOException {
int bytesRead = 0;
int bytesWritten = 0;
byte buffer[] = new byte[bisBufferSize];
if (maxLength>0) {
} else {
maxLength = 0;
break;
}
} else {
}
}
return bytesWritten;
}
}