Package jmri.jmrix.loconet.spjfile
Class SpjFile.Header
- java.lang.Object
-
- jmri.jmrix.loconet.spjfile.SpjFile.Header
-
- Direct Known Subclasses:
SpjFile.FirstHeader
- Enclosing class:
- SpjFile
public class SpjFile.Header extends java.lang.Object
Class representing a header record.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) byte[]
bytes
(package private) int
dataLength
(package private) int
dataStart
(package private) java.lang.String
filename
(package private) int
handle
(package private) static int
HEADERSIZE
(package private) int
recordLength
(package private) int
recordStart
(package private) SdfBuffer
sdfBuffer
(package private) int
spare1
(package private) int
spare2
(package private) int
spare3
(package private) int
spare4
(package private) int
spare5
(package private) int
spare6
(package private) int
spare7
(package private) int
time
(package private) int
type
-
Constructor Summary
Constructors Constructor Description Header()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getByteArray()
int
getDataLength()
int
getDataStart()
int
getHandle()
java.lang.String
getName()
int
getRecordLength()
Get Record Length.int
getRecordStart()
SdfBuffer
getSdfBuffer()
Get as a SDF buffer.int
getType()
boolean
isMap()
boolean
isSDF()
boolean
isTxt()
boolean
isWAV()
(package private) void
load(java.io.InputStream s)
void
setContent(byte[] array, int start, int length)
Provide new content.void
setDataStart(int i)
void
setName(java.lang.String name)
void
setRecordLength(int i)
void
setRecordStart(int i)
(package private) int
store(byte[] buffer, int index)
(package private) void
store(java.io.OutputStream s)
java.lang.String
toString()
java.lang.String
typeAsString()
(package private) void
updateStart(int newRecordStart)
Data record associated with this header is being being repositioned.
-
-
-
Field Detail
-
HEADERSIZE
static final int HEADERSIZE
- See Also:
- Constant Field Values
-
type
int type
-
handle
int handle
-
recordStart
int recordStart
-
dataStart
int dataStart
-
dataLength
int dataLength
-
recordLength
int recordLength
-
time
int time
-
spare1
int spare1
-
spare2
int spare2
-
spare3
int spare3
-
spare4
int spare4
-
spare5
int spare5
-
spare6
int spare6
-
spare7
int spare7
-
filename
java.lang.String filename
-
bytes
byte[] bytes
-
-
Constructor Detail
-
Header
public Header()
-
-
Method Detail
-
getType
public int getType()
-
getHandle
public int getHandle()
-
getDataStart
public int getDataStart()
-
setDataStart
public void setDataStart(int i)
-
getDataLength
public int getDataLength()
-
getRecordStart
public int getRecordStart()
-
setRecordStart
public void setRecordStart(int i)
-
getRecordLength
public int getRecordLength()
Get Record Length.This method, in addition to returning the needed record size, will also pull a SdfBuffer back into the record if one exists.
- Returns:
- record length.
-
setRecordLength
public void setRecordLength(int i)
-
getName
public java.lang.String getName()
-
setName
public void setName(java.lang.String name)
-
getByteArray
public byte[] getByteArray()
-
getSdfBuffer
public SdfBuffer getSdfBuffer()
Get as a SDF buffer. This buffer then becomes associated, and a later write will use the buffer's contents.- Returns:
- the byte array as SDF buffer.
-
updateStart
void updateStart(int newRecordStart)
Data record associated with this header is being being repositioned.- Parameters:
newRecordStart
- identify the new start record
-
setContent
public void setContent(byte[] array, int start, int length)
Provide new content. The data start and data length values are computed from the arguments, and stored relative to the length.- Parameters:
array
- New byte array; copied into headerstart
- data start location within arraylength
- data length in bytes (not record length)
-
store
int store(byte[] buffer, int index)
-
store
void store(java.io.OutputStream s) throws java.io.IOException
- Throws:
java.io.IOException
-
load
void load(java.io.InputStream s) throws java.io.IOException
- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isWAV
public boolean isWAV()
-
isSDF
public boolean isSDF()
-
isMap
public boolean isMap()
-
isTxt
public boolean isTxt()
-
typeAsString
public java.lang.String typeAsString()
-
-